> The map_from and map_to parameters take "the name of the 'many to one'
> relationship or foreign key...", not the name of a column.  (This  
> allows
> multi-column relationships and fks in mapping tables.)
>
> http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ 
> Metadata/Relat
> ionship/ManyToMany.pm#map_from
>
> http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ 
> Metadata/Relat
> ionship/ManyToMany.pm#map_to
>
> So, for example, look in Product2Color and find the name of the fk  
> or rel
> that points to a Color object.  The name of that rel or fk is the  
> value for
> your map_to param here:


Ah.  I found my error!

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

MyApp::Product2Color
     columns => [
         product_id                    => { type => 'bigint',  
not_null => 1 },
         color_id                          => { type => 'bigint',  
not_null => 1 },

     foreign_keys => [
         product=> {
             class       => 'MyApp::Product',
             key_columns => { product_id => 'id' },
         },

For some stupid reason, I was naming FKeys using the same way i name  
relationships -- i probably copy/pasted.  changing the p2c fkey to  
'product_id' fixed that immediately.



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      FindMeOn.com - The cure for Multiple Web Personality Disorder
|      Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      RoadSound.com - Tools For Bands, Stuff For Fans
|      Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-------------------------------------------------------------------------
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