NAME
Class::DBI::Relationship::IsA - A Class::DBI module for 'Is A' relationships
DESCRIPTION
Class::DBI::Relationship::IsA Provides an Is A relationship between Class::DBI classes. This should DTRT when you specify an IsA relationship between classes transparently. For more information See Class::DBI and Class::DBI::Relationship.
SYNOPSIS
# in your database (assuming mysql) #
create table person ( personid int primary key auto_increment, firstname varchar(32), initials varchar(16), surname varchar(64), date_of_birth datetime );
create table artist ( artistid int primary key auto_increment, alias varchar(128), person int );
# in your classes #
package Music::DBI;
use base 'Class::DBI';
Music::DBI->connection('dbi:mysql:dbname', 'username', 'password');
# superclass #
package Music::Person;
use base 'Music::DBI';
Music::Artist->table('person');
Music::Artist->columns(All => qw/personid firstname initials surname date_of_birth/);
# child class #
package Music::Artist;
use base 'Music::DBI';
use Music::Person; # required for access to Music::Person methods
Music::Artist->table('artist');
Music::Artist->columns(All => qw/artistid alias/);
Music::Artist->has_many(cds => 'Music::CD');
Music::Artist->is_a(person => 'Person'); # Music::Artist inherits accessors from Music::Person
# ... elsewhere .. #
use Music::Artist;
my $artist = Music::Artist->create( {firstname=>'Sarah', surname=>'Geller', alias=>'Buffy'});
$artist->initials('M');
$artist->update();
SEE ALSO
Class::DBI
Class::DBI::Relationship
AUTHOR
Richard Hundt, <richard@webtk.org>
COPYRIGHT
Licensed for use, modification and distribution under the Artistic and GNU GPL licenses.
Copyright (C) 2004 by Richard Hundt and Aaron Trevena
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.