in reply to Re: Extension of DBIC "model" class
in thread Extension of DBIC "model" class
No, this is different case, all examples in joining manuals describe how to access related but independent objects - there is always one object one row.
What I am looking for is how to implement the inheritance with additional attributes in DBIC.
An unsophisticated example:
-- I have an animal table describing species create table myschema.animal ( species varchar2(64) primary key, region varchar2(64) ); -- and some tables extending the animal create table myschema.animal_mammal ( species varchar2(64), -- foreign key max_height number, quadrupedal number(1) default 1 -- 0 or 1 ); create table myschema.animal_bird ( species varchar2(64), -- foreign key max_wingspan number, number_of_eggs number );
I would like to create the DBIC classes for mammal and bird so I can work with them as single objects.
my $dog = $schema->resultset('Mammal')->find('Canis familiaris'); warn $dog->region, ' ', $dog->max_height; my $chimp = $schema->resultset('Mammal')->create({ 'species' => 'Pan troglodytes', 'region' => 'Africa', 'quadrupedal' => 0, });
|
|---|