Re: has_a and the accessor name
[prev]
[thread]
[next]
[Date index for 2005/03/28]
Am 28.03.2005 um 08:23 schrieb Peter Speltz:
>> one question about is_a:
>> my application is strong hierarchical, i process my classes topdown,
>> so
>> i first create the data in main and THEN set the data in the child
>> class(es). it seems that i can't use is_a for that, because is_a wants
>> the child to be created first and then creates the parent row(s).
>>
>> so with is_a there is no way to create Newsletter::Main first and THEN
>> the attributes, am i right?
>> just curious about that, but might_have seems to be a perfect joice...
>
> No. is_a creates the base class first then the sub class. It works
> great. It
> sets a before create trigger on your class to create the sub (parent)
> class.
hmm, yes that's true. but what i mean is, that my Main is created
before (because my application does that), and then i can't update via
is_a...
so this works:
my $newsletter = Newsletter::Attributes->create({vorname=>'some',
nachname =>'name'});
$newsletter->email('bla@xxxx.xxx');
$newsletter->update;
but my application sets
my $newsletter = Newsletter::Main->create({email=>'bla@xxxx.xxx'});
the Main table first, then i would neet to update the Attributes table,
with is_a there is no connnection from Main -> Attributes. as i said
before might_have handles that perfectly...
thanks
josef