[CDBI] Subclass won't inherit trigger?

[prev] [thread] [next] [Date index for 2005/10/03]

From: Phil Mitchell
Subject: [CDBI] Subclass won't inherit trigger?
Date: 17:01 on 03 Oct 2005
I have a Page class with a before_create trigger. Page has a subclass,
User, which (of course) inherits the trigger. When I added an
after_create trigger to User, it stops inheriting the before_create
trigger. This is not good, since creation fails without the setup in
before_create. This arrangement works fine with other subclasses.

User's cdbi setup:

sub essential_columns {
  my @essential =3D 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 =3D> __PACKAGE__->essential_columns);
__PACKAGE__->add_trigger(after_create  =3D> \&_after_create);

Here's Page:

__PACKAGE__->table('page');
__PACKAGE__->columns(Primary =3D> qw/id /);

__PACKAGE__->columns(Essential =3D> qw/page_type
                                     created
                                     edit_date
                                     edit_by
                                     user_owner
                                     club_owner
                                     permissions
                                     locked_since
                                     locked_by
                                     title
                                     body /);

__PACKAGE__->columns(Others =3D> qw/shelf /);

__PACKAGE__->has_a(shelf        =3D> 'Reef::M::DBI::Shelf');
__PACKAGE__->has_a(locked_by    =3D> 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(edit_by      =3D> 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(user_owner   =3D> 'Reef::M::DBI::Page::User');
__PACKAGE__->has_a(club_owner   =3D> 'Reef::M::DBI::Page::Club');

__PACKAGE__->has_a(created =3D> 'DateTime',
=09=09   inflate =3D> sub { DateTime::Format::ISO8601->parse_datetime(shift=
) },
=09=09   deflate =3D> sub { shift->iso8601() });

__PACKAGE__->has_a(edit_date =3D> 'DateTime',
=09=09   inflate =3D> sub { DateTime::Format::ISO8601->parse_datetime(shift=
) },
=09=09   deflate =3D> sub { shift->iso8601() });

__PACKAGE__->has_a(locked_since =3D> 'DateTime',
=09=09   inflate =3D> sub { DateTime::Format::ISO8601->parse_datetime(shift=
) },
=09=09   deflate =3D> sub { shift->iso8601() });

__PACKAGE__->has_many(tags =3D> 'Reef::M::DBI::Tag');

__PACKAGE__->add_trigger(before_create  =3D> \&_before_create);
__PACKAGE__->add_trigger(before_update  =3D> \&_before_update);





--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
2People Blog: http://2-people.blogspot.com/
2People site: http://www.2people.org

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Subclass won't inherit trigger?
Phil Mitchell 17:01 on 03 Oct 2005

Generated at 10:29 on 10 Oct 2005 by mariachi v0.52