[Catalyst] Catalyst::Controller::DBIC::Transaction Integration

Carl Franks fireartist at gmail.com
Mon Mar 16 10:45:24 GMT 2009


2009/3/16 David Schmidt <davewood at gmx.at>:
> Hello list,
>
> I need to put all DBIC Operations in an action into a transaction and
> thought the use of
>
> http://search.cpan.org/~druoso/Catalyst-Controller-DBIC-Transaction-0.3/lib/Catalyst/Controller/DBIC/Transaction.pm
>
> would be a good idea, but ever since I added  C::C::DBIC::Controller
> with "use parent" FormFu doesnt work anymore.
>
>  use parent qw/
>            Catalyst::Controller::DBIC::Transaction
>            Catalyst::Controller::HTML::FormFu
>            /;
>
> sub create :Path('create') :Args(0) :FormConfig('accounts/create.yml')
> :DBICTransaction('myDB') {
>    my ( $self, $c ) = @_;
>    my $form = $c->stash->{form};
>    if ($form->submitted_and_valid) {
>    ...
> }
>
> The error message basically says:
>
> Can't call method "submitted_and_valid" on an undefined value at
> /home/david/temp/catalyst/nolabel2/Nolabel2/script/../lib/Nolabel2/Controller/Accounts.pm
> line 41.
>  at /usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 954

I think now that Catalyst::Controller::HTML::FormFu isn't first in the
inheritance list, its create_action() isn't being called.

If you change it to the following, you should find it works again:

 use parent qw/
           Catalyst::Controller::HTML::FormFu
           Catalyst::Controller::DBIC::Transaction
           /;

If any Cat dev could point me to a Cat controller that does the action
registering correctly, so I can fix C-C-HTML-FormFu, I'd very much
appreciate it.

Carl



More information about the Catalyst mailing list