On Sun, Jul 5, 2009 at 7:43 PM, <[email protected]> wrote: > > hi , everyone, > > i m trying to put transactions in place for my catalyst project. > > For example, I would like to create a new user subscription. > What this does is, > - create two new Address objects (Address db table) where one's for > billing address and another for main contact. > - create a new User Subscriptions object (and link the two new Address > objects by IDs into attributes, billing_address_id and > main_contact_address_id). > > > What I have refered to: > > > http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Manual/Cookbook.pod<http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Manual/Cookbook.pod> > > http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_do > > http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_begin > > http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_commit > > http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Storage.pm<http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Storage.pm> > > > In the past, when I had to work with just DBI, I would manually start a > transaction and commit it at the end if no exceptions occur. In > the case of the latter, I will call a rollback. > > How do I do it here in Catalyst/DbiX::Class land? > I tried to read up the > http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_do > doc but I can't see how the example can apply to Catalyst. > > It says, "$schema->txn_do($coderef)" to get the schema but in catalyst, > we access the > database tables directly. For example, > > > my $rs = $c->model('myAppDB::UserSusbcriptions')->search( .. ); > > > > I'm a bit confused and have looked in a few places. Can anyone please > educate me? > > thank you:) > > You're using Catalyst::Model::DBIC::Schema, so perhaps look at the pod there?
http://search.cpan.org/~mstrout/Catalyst-Model-DBIC-Schema-0.25/lib/Catalyst/Model/DBIC/Schema.pm#schema
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
