Re: [CDBI] has_many inflate?

[prev] [thread] [next] [Date index for 2005/08/09]

From: William Ross
Subject: Re: [CDBI] has_many inflate?
Date: 09:42 on 09 Aug 2005
On 9 Aug 2005, at 00:48, Christopher H. Laco wrote:

> Do all of the reltionships support inflate?
>
> Currently I've got an old 3-argument style has_many:
>
>
>
>> __PACKAGE__->has_many(_items => 'Handel::Order::Item', 'orderid');
>>
>
> I want to specify an inflate in a secondary has_many [to turn off  
> autoupdates in rare circumstances] and still keep that foreign key  
> field name argument, but I'm not having any luck.
>
>
>> __PACKAGE__->has_many(_items => 'Handel::Order::Item', 'orderid');
>> __PACKAGE__->has_many(_items_no_update => 'Handel::Order::Item',  
>> inflate => 'new_autoupdateoff', 'orderid');

There isn't an inflate argument to has_many: one of many  
inconsistencies that I hope Tony's new architecture will eliminate.  
However, you can use the shortcut that's normally meant for joining  
relationships to return the results of any other method called on the  
foreign object:

   __PACKAGE__->has_many(_items => ['Handel::Order::Item' =>  
'noautoupdate'], 'orderid');

will call $object->noautoupdate for each related object and return  
the results of that call instead of the object itself.

However, all this is nasty hackery and uses methods which are  
themselves ugly sticking plaster solutions to achieve ends other than  
the ones they were meant for. So I wouldn't recommend it.

Much better to go back to basic requirements and see how they can be  
met, which seems to be where your conversation with Ed is going.

will


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] has_many inflate?
Christopher H. Laco 23:48 on 08 Aug 2005

[CDBI] Transaction over parent and children has_a objects
Christopher H. Laco 01:49 on 09 Aug 2005

Re: [CDBI] has_many inflate?
William Ross 09:42 on 09 Aug 2005

Generated at 13:17 on 19 Aug 2005 by mariachi v0.52