[Catalyst] Best practice for using transactions?

Robert 'phaylon' Sedlacek rs at 474.at
Fri Dec 15 14:54:15 GMT 2006


Brandon Black wrote:

> Or on the other hand, you could probably do it as a Controller
> base-class using the begin and end methods there too, and then you
> still have the option of some readonly controller not using
> transactions.

While we're at making transaction-scopes smaller, I'd even go further
and make a Catalyst::Action::TransactionDBIC. As I understand DBICs
current handling of nested txn_do's, you could use such an action class
for all actions which should occur in a transaction and it will DTRT and
run it all in one big transaction. Well, except you forward to multiple
actions with TransactionDBIC from one without. But this might still be
the right thing to do, depending on what you want.

gr.,
Robert

-- 
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs at 474.at ', Web => ' http://474.at ' }



More information about the Catalyst mailing list