[Catalyst] subclassing model classes

Alexander Hartmaier alexander.hartmaier at t-systems.at
Wed Dec 16 13:03:15 GMT 2009


DBIx::Class::Helper::SubClass fixes the relationships too!
I've spoken about the problem that rels stop working when subclassing a
result class in the irc channel but at that time there wasn't a solution
for it.

Thanks for the hint, I will try it out soon!

--
Best regards, Alex


Am Mittwoch, den 16.12.2009, 13:42 +0100 schrieb matthew couchman (JIC):
> 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/
>
> _______________________________________________
> 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@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list