[CDBI] Scope of autoupdate/update?

Christopher H. Laco claco at chrislaco.com
Tue Aug 9 00:49:54 BST 2005


William Ross wrote:
> 
> On 2 Aug 2005, at 20:54, Christopher H. Laco wrote:
> 
>> Christopher H. Laco wrote:
>>
>>
>>> I think it should be possible to create a custom HAS_A  relationship 
>>> class that automatically flips the autoupdate bit  based on the 
>>> parents autoupdate bit, but that of course assumes  that autoupdate 
>>> is scoped correctly.
>>>
>>
>> So, with that said, what's the best way to disable the autoupdate  for 
>> all instances returned by a has_a relationship without actually  
>> cycling through each result before passing it along?
> 
> 
> Custom inflation method?
> 
>   Handel::Cart->has_a(thing => 'My::Artist',
>     inflate => 'inflate_without_autoupdate',
>   );
> 
> and in your base class, something like:
> 
>   sub inflate_without_autoupdate {
>     my ($class, $id) = @_;
>     my $self = $class->_simple_bless($id);
>     $self->autoupdate(0);
>     return $self;
>   }
> 
> but I haven't ever needed to do this, nor tested any of the above :)
> 
> will
> 
> 

Just to touch on this in my latest post, it's a has_many relationship, 
not a has_a, and I've specified the fk field name.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20050808/eec892f0/smime.bin


More information about the ClassDBI mailing list