Re: has_a and the accessor name
[prev]
[thread]
[next]
[Date index for 2005/03/26]
On 26 Mar 2005, at 07:38, Josef Chladek wrote:
> maybe this is purely trivial, but i can't find a solution:
>
> i have a ont-to-one relationship between two tables:
>
> package Newsletter::Main;
> use base 'Newsletter::DBI';
>
> __PACKAGE__->table( "Newsletter" );
> __PACKAGE__->columns(Primary => qw /id/);
> __PACKAGE__->columns(Essential => qw /email/ );
> __PACKAGE__->columns(Others => qw /no_mails modified md5/ );
> __PACKAGE__->has_a( "id", "Newsletter::Attributes");
from the docs:
*NOTE* You should not attempt to make your primary key column
inflate
using has_a() as bad things will happen. If you have two tables
which
share a primary key, consider using might_have() instead.
Do your tables really need to be separate? If yes, you will need to add
a column to one of them that refers to the key in the other, and
declare your has_a or might_have on that. You might also want to look
at Class::DBI::Relationship::IsA.
will
|
|
Re: has_a and the accessor name
William Ross 08:46 on 26 Mar 2005
|