[Catalyst] Catalyst and transactions
Jason Konrad
jason at popularmedia.com
Fri May 25 21:51:22 GMT 2007
I got some help from the DBIx list today which helped me get the txn_do()
method working for my schema which is created with the loader
----Schema--------
package kRadDB;
use strict;
use base qw/DBIx::Class::Schema::Loader/;
__PACKAGE__->loader_options(
relationships => 1,
);
The solution was to create a schema instance like so,
my $schema = kRadDB->connect(...);
Then do the transaction
$schema->txn_do($coderef);
This does accomplish what I was trying to do but aren't there some
connections around that I could use rather than manually connecting each
time I need to do this transaction?
The docs for Catalyst-Model-DBIC-Schema say
# to access schema methods directly:
$c->model('FilmDB')->schema->source(...);
When I try a similar thing,
$c->model('kRadDB')->schema
I get this error " Can't call method "schema" without a package or object
reference"
Thanks for any advice/help,
Jason
More information about the Catalyst
mailing list