[Catalyst] Catalyst::Model::DBIC::Schema and result classes

Matt S Trout dbix-class at trout.me.uk
Fri Mar 31 18:57:18 CEST 2006


Richard Jolly wrote:
> On 30 Mar 2006, at 18:10, Brandon Black wrote:
> 
>> On 3/30/06, Richard Jolly <Richard.Jolly at bbc.co.uk> wrote:
>>> I'm trying to get started with C::M::DBIC::Schema. I have an existing 
>>> schema
>>> defined, but C::M::DBIC::Schema does not seem to be picking up custom
>>> result_classes .
>>>
>>> The schema is defined like:
>>>
>>> PIP::Schema;
>>> PIP::Schema::Pip           # source/table definitions
>>> PIP::ResultSet::Pip         # custom resultset classes
>>> PIP::Pip                         # result class additional
>>> methods
>> Have I got this part straight?
>>
>> PIP::Schema ISA DBIx::Class::Schema
>> PIP::Schema::Pip is the source definition for table "pip", which has a
>> ->resultset_class of:
>> PIP::ResultSet::Pip which ISA DBIx::Class::ResultSet,
> 
> yes ...
> 
>> and also does a
>> use base on:
>> PIP::Pip
> 
> nope. The row objects returned from $schema->resultset('Pip')->search() 
> are PIP::Pip objects. I've been calling that the 'result class', but my 
> terminology could be off. Any methods on the row object additional to 
> the ones  get to defined there. I don't know how/if you can specify the 
> row/result_class package in DBIC. I just happened to notice that:

You can specify the result_class as an attr or by calling the accessor on an 
rs before you start returning objects.

-- 
      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