[Catalyst] Handling Exceptions
Kiefer, Sascha
sk at intertivity.com
Sun Apr 16 21:30:04 CEST 2006
Here you go:
---------------------------------------------------------------------
package PBoard::Model::DBIC;
use strict;
use base 'Catalyst::Model::DBIC';
__PACKAGE__->config(
dsn => 'dbi:mysql:dbname=x',
user => 'x',
password => 'x',
options => { AutoCommit => 0 }, # was {}
relationships => 1
);
1;
---------------------------------------------------------------------
package PBoard::Model::DBIC::PbUser;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->has_many(roles => 'PBoard::Model::DBIC::PbUserRole',
'userId' );
__PACKAGE__->has_one (profile => 'PBoard::Model::DBIC::PbUserProfile',
'userId' );
__PACKAGE__->has_one (settings => 'PBoard::Model::DBIC::PbUserSettings',
'userId' );
1;
---------------------------------------------------------------------
package PBoard::Model::DBIC::PbUserProfile;
use strict;
use warnings;
use base 'DBIx::Class::Core';
1;
---------------------------------------------------------------------
package PBoard::Model::DBIC::PbUserRole;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->belongs_to(role => 'PBoard::Model::DBIC::PbRole', 'roleId' );
__PACKAGE__->belongs_to(user => 'PBoard::Model::DBIC::PbUser', 'userId' );
1;
---------------------------------------------------------------------
package PBoard::Model::DBIC::PbRole;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->has_many(roles => 'PBoard::Model::DBIC::PbUserRole', 'roleId'
);
1;
---------------------------------------------------------------------
package PBoard::Model::DBIC::PbUserSettings;
use strict;
use warnings;
use base 'DBIx::Class::Core';
use DateTime::Format::MySQL ();
__PACKAGE__->inflate_column('registerDate', {
inflate => sub { DateTime::Format::MySQL->parse_datetime(shift); },
deflate => sub { DateTime::Format::MySQL->format_datetime(shift); },
});
1;
---------------------------------------------------------------------
The rest of the code you have seen already.
--esskar
> -----Original Message-----
> From: Matt S Trout [mailto:dbix-class at trout.me.uk]
> Sent: Sonntag, 16. April 2006 21:16
> To: sk at intertivity.com
> Cc: 'The elegant MVC web framework'
> Subject: Re: [Catalyst] Handling Exceptions
>
>
> Kiefer, Sascha wrote:
> > Well, it doesn't.
> > Do i have to set some special options or anything similar?
>
> Are you currently using AutoCommit?
>
> What are the results if you call commit/rollback straight
> onto the dbh?
>
> When are you going to post the damn classes so I have some
> idea what your
> code's doing?
>
> --
> Matt S Trout Offering custom development,
> consultancy and support
> Technical Director contracts for Catalyst, DBIx::Class
> and BAST. Contact
> Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for
> more information
>
> + Help us build a better perl ORM:
> + http://dbix-class.shadowcatsystems.co.uk/ +
>
More information about the Catalyst
mailing list