[Catalyst] Possibly OT: CDBI inheritance broken
Phil Mitchell
phil.mitchell at pobox.com
Thu Oct 6 23:52:56 CEST 2005
Got no help on this from CDBI list, thought people here might have
some ideas. This is for a catalyst app that uses CDBI but not Sweet or
Loader... Basically, I added a trigger to a subclass of my Page class,
and suddenly the subclass stopped inheriting the things it should
inherit (like other triggers, relationships...)
CDBI wiki does mention a related issue, but the fix given has not
helped: http://wiki.class-dbi.com/index.cgi?InheritedRelationships
Relevant extracts from my classes:
Subclass of Page cdbi setup:
sub essential_columns {
my @essential = Reef::M::DBI::Page->_essential;
push @essential, qw/username password person_name email/;
push @essential, $GEO_VALIDATION->core_location_fields();
return @essential
}
__PACKAGE__->columns(Essential => __PACKAGE__->essential_columns);
__PACKAGE__->add_trigger(after_create => \&_after_create);
Here's Page:
__PACKAGE__->table('page');
__PACKAGE__->columns(Primary => qw/id /);
__PACKAGE__->columns(Essential => qw/page_type
created
edit_date
edit_by
user_owner
club_owner
permissions
locked_since
locked_by
title
body /);
__PACKAGE__->columns(Others => qw/shelf /);
__PACKAGE__->has_a(shelf => 'Reef::M::DBI::Shelf');
__PACKAGE__->has_a(locked_by => 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(edit_by => 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(user_owner => 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(club_owner => 'Reef::M::DBI::Page::Club');
__PACKAGE__->has_a(created => 'DateTime',
inflate => sub {
DateTime::Format::ISO8601->parse_datetime(shift) },
deflate => sub { shift->iso8601() });
__PACKAGE__->has_a(edit_date => 'DateTime',
inflate => sub {
DateTime::Format::ISO8601->parse_datetime(shift) },
deflate => sub { shift->iso8601() });
__PACKAGE__->has_a(locked_since => 'DateTime',
inflate => sub {
DateTime::Format::ISO8601->parse_datetime(shift) },
deflate => sub { shift->iso8601() });
__PACKAGE__->has_many(tags => 'Reef::M::DBI::Tag');
__PACKAGE__->add_trigger(before_create => \&_before_create);
__PACKAGE__->add_trigger(before_update => \&_before_update);
--
==========================
2People Blog: http://2-people.blogspot.com/
2People site: http://www.2people.org
More information about the Catalyst
mailing list