[CDBI] has_a relationship with non-primary column?
phombaiah at gmail.com
Wed Sep 5 19:38:19 BST 2007
Thanks for your help.
I should have mentioned that not only is this a non-primary key as far as
the database is concerned but a non-primary key in the class-dbi code as
__PACKAGE__->columns(All => qw/real_pk desired_column dept_name/);
__PACKAGE__->columns(Primary => qw/real_pkid/);
__PACKAGE__->has_many( options => 'Employees' );
__PACKAGE__->columns(All => qw/emp_id department employee_name/);
__PACKAGE__->columns(Primary => qw/emp_id/);
# Is it possible to link this relationship with
__PACKAGE__->has_a( department => 'Department' );
On 9/4/07, Perrin Harkins <perrin at elem.com> wrote:
> On 9/4/07, Praveen Hombaiah <phombaiah at gmail.com> wrote:
> > Is it possible to setup a has_a relationship with a non-primary key
> Yes, if the column is unique.
> > If so, how can it be expressed.
> The usual syntax should work.
> - Perrin
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ClassDBI