in reply to Re: Class::DBI global questions and references (partly explained, waiting for more ;)
in thread Class::DBI global questions and references
Actually, this is not true. When you call has_a, you just have to give it the name of an accessor in the current class that will return the primary key for the other class. You give your accessors any name you like. For example, I could change your example like this:
package MyPackage::User; use base ('MyPackage'); MyPackage::User->table('user'); MyPackage::User->columns(Essential => qw(id role_id name lastname)); __PACKAGE__->has_a(wild_and_crazy_role => 'MyPackage::Role'); sub accessor_name { my ($class, $column) = @_; $column =~ s/role_id/wild_and_crazy_role/; return $column; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Class::DBI global questions and references (partly explained, waiting for more ;)
by parasew (Beadle) on Sep 30, 2003 at 22:36 UTC |