I'm struggling to discern whether my failure here is my syntax or a limitation in the RDBO magic.
Forgive me if is this is documented somewhere; the many to many examples I've looked at today (and used before) deal with 3 tables, e.g., widgets, colors and widget_color_map. What I'm trying to do is add a 4th table and get the map working accordingly, e.g., widgets, colors, sizes and widget_color_size_map. In my case, it's users, roles and sites. create table users ( id serial PRIMARY KEY, username varchar(63) not null ) ENGINE=INNODB; create table sites ( id serial PRIMARY KEY, url varchar(128), nick varchar(12) ) ENGINE=INNODB; create table roles ( id serial PRIMARY KEY, name varchar(31) not null ) ENGINE=INNODB; create table users_roles ( users_id bigint unsigned not null, roles_id bigint unsigned not null, sites_id bigint unsigned not null, PRIMARY KEY (users_id, roles_id, sites_id), FOREIGN KEY (users_id) REFERENCES users(id), FOREIGN KEY (roles_id) REFERENCES roles(id), FOREIGN KEY (sites_id) REFERENCES sites(id) ) ENGINE=INNODB; and here's my (generated then edited) RDBO stuff: package AL::Fresco::User; use strict; use base qw(AL::Fresco::DB::Object); __PACKAGE__->meta->setup( table => 'users', columns => [ id => {type => 'int', not_null => 1}, username => {type => 'varchar', default => '', length => 63, not_null => 1} ], primary_key_columns => ['id'], relationships => [ roles => { map_class => 'AL::Fresco::UsersRoles', type => 'many to many', } ] ); 1; package AL::Fresco::Site; use strict; use base qw(AL::Fresco::DB::Object); __PACKAGE__->meta->setup( table => 'sites', columns => [ id => {type => 'int', not_null => 1}, url => {type => 'varchar', length => 128}, nick => {type => 'varchar', length => 12}, ], primary_key_columns => ['id'], relationships => [ roles => { class => 'AL::Fresco::UsersRoles', column_map => {id => 'sites_id'}, type => 'one to many' } ] ); 1; package AL::Fresco::Role; use strict; use base qw(AL::Fresco::DB::Object); __PACKAGE__->meta->setup( table => 'roles', columns => [ id => {type => 'int', not_null => 1}, name => {type => 'varchar', default => '', length => 31, not_null => 1}, ], primary_key_columns => ['id'], relationships => [ users => { map_class => 'AL::Fresco::UsersRoles', type => 'many to many', } ] ); 1; package AL::Fresco::UsersRoles; use strict; use base qw(AL::Fresco::DB::Object); __PACKAGE__->meta->setup( table => 'users_roles', columns => [ users_id => {type => 'int', not_null => 1}, roles_id => {type => 'int', not_null => 1}, sites_id => {type => 'int', not_null => 1}, ], primary_key_columns => ['users_id', 'roles_id', 'sites_id'], foreign_keys => [ role => { class => 'AL::Fresco::Role', key_columns => {roles_id => 'id'}, }, user => { class => 'AL::Fresco::User', key_columns => {users_id => 'id'}, }, site => { class => 'AL::Fresco::Site', key_columns => {sites_id => 'id'}, } ], ); 1; when I try to do this: my $user = AL::Fresco::User->new; $user->roles({sites_id => 1, roles_id => 1}); I get a fatal err: Can't locate object method 'sites_id' via package 'AL::Fresco::Role' ... It seems like my problem is with MakeMethods::Generic or else I'm calling roles() incorrectly, but I really haven't a clue where to being looking. I'm hoping someone else has implemented this kind of idea and can provide me with a hint. cheers, pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object