[CDBI] Scope of autoupdate/update?

William Ross will at spanner.org
Tue Aug 2 21:42:04 BST 2005


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





More information about the ClassDBI mailing list