I read the mapping docs, and I just can't get it to work. An example pertaining to the above scenarion would be really helpful!
What did you try? I'm lazy, and I don't like to type.
MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] |
Fine. I understand.
Anyways.. this is what I tried
Page.pm
__PACKAGE__->has_many(columns => [ 'Page_column' => 'column_id' ]);
Page_column.pm
__PACKAGE__->has_many(columns => 'Column');
Column.pm
__PACKAGE->has_a(column_id => 'Column');
I know there is no free service available here, but I very much appreciate any help available. :-)
--
arc_of_descent
| [reply] [d/l] [select] |
You are close. Try this instead:
package Page;
__PACKAGE__->has_many(columns => 'Column');
package Page_column;
__PACKAGE__->has_a(page_id => 'Page');
__PACKAGE__->has_a(column_id => 'Column');
package Column;
__PACKAGE__->has_many(pages => 'Page');
And if your immediate question is "Why can columns have multiple pages", then you need
to go back to your 1NF 1:N design, like kal suggested. Your second example is what i call a cross
table, and the tables on the ends are the "many" relationships.
| [reply] [d/l] |
I believe that should be __PACKAGE__->has_many(columns => [ 'Page_column' => 'columns' ]); in Page.pm.
MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | ** The third rule of perl club is a statement of fact: pod is sexy. |
| [reply] [d/l] |
I'm lazy, and I don't like to type.
Phht. If you were really lazy, you'd've just typed "I'm lazy." instead.
| [reply] |