[CDBI] has_a relationship with non-primary column?

Perrin Harkins perrin at elem.com
Wed Sep 5 19:47:12 BST 2007


On 9/5/07, Praveen Hombaiah <phombaiah at gmail.com> wrote:
> 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
> well.

That should always be true.  You shouldn't need to lie to Class::DBI
about what your primary keys are.

> # Is it possible to link this relationship with employee.desired_column
> instead of
> # employee.real_pk?
> __PACKAGE__->has_a( department => 'Department' );

The first argument to has_a is the column name, so that should be
'desired_column', not 'department.'

- Perrin



More information about the ClassDBI mailing list