Re: Working on a many-to-many CDBI::Relationship

[prev] [thread] [next] [Date index for 2005/05/14]

From: Tony Bowden
Subject: Re: Working on a many-to-many CDBI::Relationship
Date: 07:49 on 14 May 2005
On Fri, May 13, 2005 at 07:25:40PM -0500, Stepan Riha wrote:
> however my code adds it to the CDBI class but one would probably prefer it be
> added to the class that "uses" it (University::DBI, in my example).
> ---------------------------------------------------------------------
> package Class::DBI::Relationship::AssociatedWith;
> use base 'Class::DBI::Relationship';
> BEGIN {
> 	Class::DBI->add_relationship_type(
> 		associated_with => "Class::DBI::Relationship::AssociatedWith"
> 	);
> }

Why not just have the 'using' class do that directly?

package My::CDBI;

__PACKAGE__->add_relationship_type(
  associated_with => "Class::DBI::Relationship::AssociatedWith"
);

That's how it's really meant to be done.

Tony

Working on a many-to-many CDBI::Relationship
Stepan Riha 00:25 on 14 May 2005

Re: Working on a many-to-many CDBI::Relationship
Tony Bowden 07:49 on 14 May 2005

Re: Working on a many-to-many CDBI::Relationship
Matt S Trout 11:19 on 14 May 2005

Generated at 15:51 on 25 May 2005 by mariachi v0.52