I am trying to set up a class which will basically be an agregator of relationships. I however have no idea of how to really do it. Basically here is what I have on the back-end
users -- id INT, username VARCHAR
user_prop_ints -- user_id INT, prop_id INT, p_value INT
user_prop_chars -- user_id INT, prop_id INT, p_value VARCHAR
user_prop_dates -- user_id INT, prop_id INT, p_value DATE
and I have 4 corresponding Rose::DB::Objects. User and the 3 prop objects. The prop objects in turn have a relationship set up with the users in a user->props way
Now, I am trying to make a consolidated interface which allows me to get all props at once from all three tables. Normally I would just create an aggregator class that managed the dispatching of the right object types and queried all tables and merged the results, but I'd like to make something that can more closely iterface with Rose and the Manager. Kind of like a 'fake' object that I can use in the meta->relationships and that will hopefully even play nice with load(with=>'props'). Do you have any idea as to what would be the cleanest way to implement this? I am open to hacking it into the Rose:: source and submitting it back to you if necessary, but I was kind of hoping there would be a cleaner way.
Should I subclass Rose::DB::Object? Should I create a new relationship type? where in the space do you think I would be best off hacking this in?
or am I missing something much more obvious?
Guillermo
On 5/3/06, John Siracusa <[EMAIL PROTECTED]> wrote:
On 5/3/06, Guillermo Roditi <[EMAIL PROTECTED]> wrote:
> I have a table which includes a blob and a field for a hash of that blob.
> I'd like to make atrigger that automatically updates the hash every time the
> blob is changed, so i figured i would do it with a trigger. I figured the
> best way to do it would be by overloading new, but that doesnt work...
You only need to add the trigger to the column once. Do it in your
class setup after you initialize():
package Cantella::PaperKiller::DB::UserPropTypeBin
...
__PACKAGE__->meta->initialize;
__PACKAGE__->meta->column('whatever')->add_trigger(...);
...
-John
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object