I have a 4 key map table , and its confusing me how to do this in rose.

Rose Tutorial:

        Products
                id , name
        Colors
                id , name
        Product2Color
                product_id , color_id

My Setup
Adds in a 'user' fkey + time to track the assignment of product 2 color

        Products
                id , name
        Colors
                id , name
        Users
                id , name
        Product2Color
                id, product_id , color_id , user_id , timestamp_noted

whats confusing me is the rose representation ( selected pieces below)

I thought it would be something like this:

MyRose::Object::Product
     relationships => [
         colors => {
             type               => 'many to many',
             map_class   => 'MyRose::Object:: Product2Color',
             map_from   => 'product_id',
             map_to => 'color_id',
         },
     ],

MyRose::Object::Color
     relationships => [
         products => {
             type               => 'many to many',
             map_class   => 'MyRose::Object:: Product2Color',
             map_from   => 'color_id',
             map_to => 'product_id',
         },
     ],

and then...

MyRose::Object::Product::Manager
                $results= Rose::DB::Object::Manager->get_objects(
                        object_class=> object_class(),
                        with_objects=> [  'colors.color'],

MyRose::Object::Color::Manager
                $results= Rose::DB::Object::Manager->get_objects(
                        object_class=> object_class(),
                        with_objects=> [  'products.product'],

but i keep getting errors.  advice



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to