Re: [CDBI] has_a relationship with non-primary column?
"Perrin Harkins" <[email protected]> Thu, 6 Sep 2007 23:59:45 -0400
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
On 9/6/07, Praveen Hombaiah <[email protected]> wrote: > Isn't the first argument the column(of this class ie department ) that > stores the value of the PK of the "other" class? Is it possible to store > the non-pk value of the "other" class in the column and indicate that in the > has_a declaration somehow? Oh, now I see what you're asking. You can't do that with has_a, but making your own accessor is pretty simple: sub department_object { my $self = shift; return Department->desired_column($self->department); } If you want this method to be called department and the accessor for the department column to be called something different, you can find recipes for changing accessor names on the wiki. - Perrin