[Catalyst-commits] r7705 - in
Catalyst-Controller-DBIC-Transaction/1.0/trunk:
lib/Catalyst/Action/DBIC lib/Catalyst/Controller/DBIC
t/lib/TestApp t/lib/TestApp/Controller t/lib/TestApp/Model
ruoso at dev.catalyst.perl.org
ruoso at dev.catalyst.perl.org
Tue May 6 23:49:28 BST 2008
Author: ruoso
Date: 2008-05-06 23:49:28 +0100 (Tue, 06 May 2008)
New Revision: 7705
Added:
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Model/
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Model/DB.pm
Modified:
Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm
Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm
Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm
Log:
[C-C-DBIC-Transaction] It wasnt that simple after all, using $c->model($class)->schema instead of $schema
Modified: Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm 2008-05-06 22:35:14 UTC (rev 7704)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Action/DBIC/Transaction.pm 2008-05-06 22:49:28 UTC (rev 7705)
@@ -9,7 +9,7 @@
my $self = shift;
my ( $controller, $c ) = @_;
- my $schema_class = $controller->_dbic_transaction_schemas->{$self->name}
+ my $model_class = $controller->_dbic_transaction_schemas->{$self->name}
or die 'No schema class defined for DBIC::Transaction ActionClass';
my $wantarray = wantarray;
@@ -23,7 +23,7 @@
}
};
- $schema_class->txn_do($sub);
+ $c->model($model_class)->schema->txn_do($sub);
if ($wantarray) {
return @return;
@@ -42,7 +42,7 @@
=head1 SYNOPSIS
use base qw(Catalyst::Controller::DBIC::Transaction);
- sub foo :DBICTransaction('DB::Schema') {
+ sub foo :DBICTransaction('DB') {
do $something or die $!;
}
@@ -50,7 +50,7 @@
This module enables the use of automatic transaction support into
Catalyst Actions, it will associate a given action with the
-appropriate action class and save the DBIx::Class::Schema class name
+appropriate action class and save the DBIC::Schema model class name
for later use.
The action will be executed inside a txn_do, and a die inside that
Modified: Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm 2008-05-06 22:35:14 UTC (rev 7704)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/lib/Catalyst/Controller/DBIC/Transaction.pm 2008-05-06 22:49:28 UTC (rev 7705)
@@ -29,7 +29,7 @@
=head1 SYNOPSIS
use base qw(Catalyst::Controller::DBIC::Transaction);
- sub foo :DBICTransaction('DB::Schema') {
+ sub foo :DBICTransaction('DB') {
do $something or die $!;
}
@@ -37,7 +37,7 @@
This module enables the use of automatic transaction support into
Catalyst Actions, it will associate a given action with the
-appropriate action class and save the DBIx::Class::Schema class name
+appropriate action class and save the DBIC::Schema model class name
for later use.
The action will be executed inside a txn_do, and a die inside that
Modified: Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm 2008-05-06 22:35:14 UTC (rev 7704)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Controller/Foo.pm 2008-05-06 22:49:28 UTC (rev 7705)
@@ -4,7 +4,7 @@
use strict;
use warnings;
-sub bar :Local :DBICTransaction('MyTestSchemaReplacer') {
+sub bar :Local :DBICTransaction('DB') {
my ($self, $c) = @_;
::ok('Inside the method');
Added: Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Model/DB.pm
===================================================================
--- Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Model/DB.pm (rev 0)
+++ Catalyst-Controller-DBIC-Transaction/1.0/trunk/t/lib/TestApp/Model/DB.pm 2008-05-06 22:49:28 UTC (rev 7705)
@@ -0,0 +1,9 @@
+package TestApp::Model::DB;
+
+use base 'Catalyst::Model';
+
+sub schema {
+ return bless {}, 'MyTestSchemaReplacer';
+}
+
+1;
More information about the Catalyst-commits
mailing list