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

Richard Jolly richardjolly at mac.com
Fri Mar 31 07:47:39 CEST 2006


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:

   ref $schema->resultset('Pip')->search->first eq 'PIP::Pip'

So thats where I stuck any methods on the row object that I needed.

If my package hierarchy is off, or non-standard, I'd love to correct it 
now.

Richard

> ?



> -- Brandon
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>




More information about the Catalyst mailing list