Re: CDR::IsA and *has_many* relationships in the parent class

[prev] [thread] [next] [Date index for 2005/03/20]

From: Peter Speltz
Subject: Re: CDR::IsA and *has_many* relationships in the parent class
Date: 04:31 on 20 Mar 2005
--- Peter Speltz <peterspeltz@xxxxx.xxx> wrote:
> 
> --- Rhesa Rozendaal <perl@xxxxx.xxx> wrote:
> > 
> > Rhesa Rozendaal wrote:
> 
> > It seems I need to narrow down this assertion: has_a relationships are
> > handled quite well; it's only the has_many relationships that are not
> > taken into account, as far as I can see. I haven't investigated any of the
> > other relationship types, so this question really is only about
> > how to integrate has_many relations from the parent class into the child
> > class.
> > 
> 
> Did you try "inheriting" the has_many accessor by including in the sub
> class's
> all columns list?  Not sure if that will work as its not really a column. Not
> sure this is a good hack either cause it could get confusing. 
> 
> Base::Class->has_many(things => Thing::Class);
> ...
> Sub::Class->is_a(fk => Base::Class);
> Sub::Class->columns(All => qw/.. .. things/);
> 

Also, you could always say:

sub_class_obj->fk->things; # access is_a object directly.

Also does might_have allow you to specify a has_many accessor in the "methods"
list you pass when you create it?

Class->might_have(baseclass => Base::Class, qw/things .. ../);
if (@hms = class_obj->things) { print "We inherit has_many accessor from
mighthave" }

 If so that code could be useful.



pjs


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

(message missing)

Re: CDR::IsA and *has_many* relationships in the parent class
Peter Speltz 04:31 on 20 Mar 2005

Generated at 15:09 on 27 Mar 2005 by mariachi v0.52