Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Class::DBI has_a() relationships with multi-value keys

by perrin (Chancellor)
on Oct 29, 2004 at 19:21 UTC ( [id://403880]=note: print w/replies, xml ) Need Help??


in reply to Class::DBI has_a() relationships with multi-value keys

Don't worry, it's easy.
sub foreign_obj { my $self = shift; my $foreign_obj = Foreign::Class->retrieve( key1 => $self->key1(), key2 => $self->key2(), ); return $foreign_obj; }

Replies are listed 'Best First'.
Re^2: Class::DBI has_a() relationships with multi-value keys
by MrCromeDome (Deacon) on Oct 29, 2004 at 21:20 UTC
    So do I do that in my parent class? If so, what does it look like in the child's definition? Or did I miss something? ;)

    MrCromeDome

      You just do that in the parent class, i.e. the one that is holding a copy of other class' primary key in its table. If you want a has_many method in the child class that goes the other way, you could code one of those too, using a search() instead of retrieve().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://403880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found