[Catalyst] subclassing model classes

matthew couchman (JIC) matthew.couchman at bbsrc.ac.uk
Wed Dec 16 12:42:05 GMT 2009


I've just discovered DBIx::Class::Helper::SubClass which seems to have done the trick. Thanks again for all your help.

> -----Original Message-----
> From: matthew couchman (JIC) [mailto:matthew.couchman at bbsrc.ac.uk]
> Sent: 16 December 2009 10:54
> To: The elegant MVC web framework
> Subject: RE: [Catalyst] subclassing model classes
> 
> Hi Wallace,
> 
> Thanks for your reply. I'm using the perl debugger:
> 
> Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A
> ntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:10):
> 10:     __PACKAGE__-
> >resultset_class('AntSpec::Schema::ResultSet::Placemark');
>   DB<1> n
> Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A
> ntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:12):
> 12:     1;
>   DB<1> x __PACKAGE__
> 0  'AntSpec::Schema::Result::Placemark'
>   DB<2> x __PACKAGE__->resultset_class
> 0  'AntSpec::Schema::ResultSet::Placemark'
>   DB<3> c
> Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A
> ntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:10):
> 10:     __PACKAGE__-
> >resultset_class('AntSpec::Schema::ResultSet::Vertex');
>   DB<3> n
> Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A
> ntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:12):
> 12:     1;
>   DB<3> x __PACKAGE__
> 0  'AntSpec::Schema::Result::Vertex'
>   DB<4> x __PACKAGE__->resultset_class
> 0  'AntSpec::Schema::ResultSet::Vertex'
>   DB<5> x AntSpec::Schema::Result::Placemark->resultset_class
> 0  'AntSpec::Schema::ResultSet::Vertex'
>   DB<6> x AntSpec::Schema::Result::Point->resultset_class
> 0  'AntSpec::Schema::ResultSet::Vertex'
> 
> 
> Thanks again,
> 
> 		Matt.
> 
> 
> 
> > -----Original Message-----
> > From: Wallace Reis [mailto:wallace at reis.org.br]
> > Sent: 15 December 2009 23:13
> > To: The elegant MVC web framework
> > Subject: Re: [Catalyst] subclassing model classes
> >
> > On 15/12/2009, at 14:58, matthew couchman (JIC) wrote:
> > > I now have a couple of subclasses of Point called Vertex and
> > Placemark. I'm trying to associate them with my new ResultSet
> > subclasses.
> > >
> > > In MyApp::Schema::Result::Vertex:
> > >
> > > use base 'MyApp::Schema::Result::Point';
> > > __PACKAGE__->resultset_class('MyApp::Schema::ResultSet::Vertex');
> > >
> > >
> > > And in MyApp::Schema::Result::Placemark:
> > >
> > > use base 'MyApp::Schema::Result::Point';
> > > __PACKAGE__-
> >resultset_class('MyApp::Schema::ResultSet::Placemark');
> > >
> > >
> > > I think __PACKAGE__->resultset_class is calling the parent class
> > MyApp::Schema::Result::Point->resultset_class in both cases so the
> > second call overwrites the first. How do I avoid this?
> >
> >
> > How are you identifying this behaviour? It shouldn't be like that.
> > What does "print $schema->source($_)->resultset_class for qw(Vertex
> > Placemark)" output?
> >
> > --
> >    wallace reis/wreis         Catalyst and DBIx::Class consultancy
> with
> > a clue
> >    Software Engineer          and a commit bit:
> > http://shadowcat.co.uk/catalyst/
> > Shadowcat Systems Limited
> > http://www.shadowcat.co.uk     http://www.linkedin.com/in/wallacereis
> > _______________________________________________
> > List: Catalyst at lists.scsys.co.uk
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-
> > archive.com/catalyst at lists.scsys.co.uk/
> > Dev site: http://dev.catalyst.perl.org/
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-
> archive.com/catalyst at lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list