Re: A trigger called when following a 'has_a'

[prev] [thread] [next] [Date index for 2004/07/20]

From: Charles Bailey
Subject: Re: A trigger called when following a 'has_a'
Date: 15:47 on 20 Jul 2004
--On Tuesday, July 20, 2004 4:37 PM +0100 Peter Pimley 
<ppimley@xxxxxxxxx.xxx> wrote:

> Charles Bailey wrote:
>
>> $class->has_a(Origin => 'Origin',
>>                inflate => sub { shift; Origin->inflate(@_); },
>>                deflate => sub { my($ori,$list) = @_;
>>                                 $list->_attribute_store($otype,
>>                                 [snip]
>
> (also noting your second email)
>
>
> That looks like a cleverer version of the temporary (read: 'permanent')
> workaround I've made:
>
> File->has_a (location => LocationFetcher)
> ... where LocationFetcher is not a Class::DBI class.  Then, in
> LocationFetcher::new...
>
> sub new {
>     my $id = shift;
>     my $location = Location->retrieve ($id); # get the correct Location
> object
>     bless $location, $location->subclass; # bless it to the correct
> subclass (subclass name stored in table)
>     return $location;
> }
>
> Like yours, it's a bit of a bodge, but it'll do the job.

Should work fine, with the restriction that $location->subclass must be a 
subclass of LocationFetcher, or CDBI will choke.

--
Regards,
Charles Bailey  < bailey _at_ newman _dot_ upenn _dot_ edu >
Newman Center at the University of Pennsylvania

(message missing)

Re: A trigger called when following a 'has_a'
Peter Pimley 14:17 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 14:42 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 14:53 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:22 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:30 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 15:37 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Charles Bailey 15:47 on 20 Jul 2004

Re: A trigger called when following a 'has_a'
Peter Pimley 10:32 on 21 Jul 2004

A trigger called when following a 'has_a' (again)
Peter Pimley 13:41 on 22 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52