[Dbix-class] Audit Trails/History Component

Tobias Kremer t at funkreich.de
Thu Aug 31 13:30:40 CEST 2006


In direct reply to my previous email. I found one possible solution:

sub insert {
  my( $self, @rest ) = @_;

  # run the other components (and let PK::Auto do its work)
  my $ret = $self->next::method( @rest );

  # now add the audit trail with the PK ...
}

Works great! Any problems with this?

Tobias


Zitat von Tobias Kremer <t at funkreich.de>:

> Unfortunately PK::Auto's insert method first calls the other components in
> the chain (as far as i understand this whole overriding-next-c3-fu) and then
> retrieves a new primary key if none is already given. This leads to the
> problem that my component needs a primary key to make a reference in the
> audit trail/history table to the modified record but it's not there because
> PK::Auto delays the fetching of a new primary key value until all other
> components
> were run(?)



More information about the Dbix-class mailing list