[Dbix-class] role of result class?
Matt S Trout
dbix-class at trout.me.uk
Wed Mar 15 15:25:32 CET 2006
Michele Beltrame wrote:
> Hello Matt!
>
>> Custom resultset class.
>>
>> package My::Schema::Foo;
>> use base qw/DBIx::Class::Core/;
>> ...
>> __PACKAGE__->resultset_class('My::Schema::Foo::ResultSet');
>>
>> package My::Schema::Foo::ResultSet;
>> use base qw/DBIx::Class::ResultSet/;
>
> I tried this solution as follows:
>
> ----------------------------------------------------
> package Aintra::M::Dbs::Schema::Calendar::ResultSet;
> use base 'DBIx::Class::ResultSet';
> use strict;
> use warnings;
>
> 1;
>
> [...]
>
> package Aintra::M::Dbs::Schema::Calendar;
> use base 'DBIx::Class';
> use strict;
> use warnings;
>
> __PACKAGE__->load_components(qw/ Core /);
__PACKAGE__->table('foo');
> __PACKAGE__->resultset_class('Aintra::M::Dbs::Schema::Calendar::ResultSet');
> ----------------------------------------------------
>
> I didn't define any methdos in the new result set for now, just let it
> inherit the base class ones. However it doesn't seem to inherit
> correctly as I get this error:
It inherits fine, but the result source isn't set up until you call ->table
Do that first and it'll work fine - that's why I had the '...' in my original
post, to indicate you wanted to do it at the end of the class setup not the start.
--
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 Dbix-class
mailing list