[Catalyst] Catalyst::Controller::DBIC::Transaction Integration
David Schmidt
davewood at gmx.at
Mon Mar 16 11:04:56 GMT 2009
Hello Carl and thanks
I already attempted to solve the problem with changing the order of
the parent classes. I still get the same error
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
DBIx::Class::Schema::throw_exception('Nolabel2::Schema=HASH(0x930f764)',
'Can\'t call method "submitted_and_valid" on an undefined valu...')
called at /usr/local/share/perl/5.8.8/DBIx/Class/Storage.pm line 122
DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::SQLite=HASH(0x93e3208)',
'Can\'t call method "submitted_and_valid" on an undefined valu...')
called at /usr/local/share/perl/5.8.8/DBIx/Class/Storage/DBI.pm line
667
DBIx::Class::Storage::DBI::txn_do('DBIx::Class::Storage::DBI::SQLite=HASH(0x93e3208)',
'CODE(0x9ee39a8)') called at
/usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 734
DBIx::Class::Schema::txn_do('Nolabel2::Schema=HASH(0x930f764)',
'CODE(0x9ee39a8)') called at
/usr/local/share/perl/5.8.8/Catalyst/Action/DBIC/Transaction.pm line
27
Catalyst::Action::DBIC::Transaction::execute('Catalyst::Action::DBIC::Transaction=HASH(0x9d78d08)',
'Nolabel2::Controller::Accounts=HASH(0x9ce8e34)',
'Nolabel2=HASH(0x9dc3794)') called at
/usr/local/share/perl/5.8.8/Catalyst/Action.pm line 32
Catalyst::Action::__ANON__('Nolabel2::Controller::Accounts=HASH(0x9ce8e34)',
'Nolabel2=HASH(0x9dc3794)') called at
/usr/local/share/perl/5.8.8/Catalyst.pm line 1220
... and so on.
ps: I read and implemented your approach to formfu validation through
a custom validator rather then a callback yesterday, thanks for that.
:)
On Mon, Mar 16, 2009 at 11:45 AM, Carl Franks <fireartist at gmail.com> wrote:
> 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
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
--
David Schmidt | http://www.fm5.at
More information about the Catalyst
mailing list