[Catalyst] Re: DBIC Inheritance not preserved in Catalyst model

Scott Thomson smoothhound at gmail.com
Mon Sep 24 14:57:05 GMT 2007


I've done a bit more digging around and it seems like it is the call to
compose_namespace in Catalyst::Model::DBIC::Schema::new that is causing this
behaviour.  Effectively it renames all the schema classes into the
MyApp::Model namespace and the ISA chain in the new namespace is not
preserved.

So this is probably more of a DBIC problem, in that any schema that is
generated using compose_namespace will be affected, so I reckon I should
post on their list.

Cheers,

Scott

On 9/21/07, Scott Thomson <smoothhound at gmail.com> wrote:
>
> I have a setup similar to this...
>
> Class B inherits from class A and class C has a relationship to A.
> A and B share the same table and use the dynamic sub-classing approach in
> the DBIC cookbook to get the sub-classing to work.
>
> When testing directly with the schema the classes behave as I would
> expect, ie. I can set the relationship on C using an object of class eith=
er
> A or B. However, when I use the schema inside my Catalyst app I get an er=
ror
> like this when trying to set the property using the relationship on A to =
an
> object of the sub-class C...
>
> DBIx::Class::MyApp::new(): Object MyApp::Model::DBIC::A::B=3DHASH(0x392b6=
a0)
> isn't a MyAPP::Model::DBIC::A (The error is generated in
> DBIx::Class::Relationship::Base::set_from_related)
>
> It seems that the B isa A relationship is not preserved within the
> MyApp::Model namespace.
>
> The model works correctly in all other ways (so far).
>
> Any ideas on how to get round this are extremely welcome  :)  I can post
> real code if required.
>
> Cheers,
>
> Scott.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070924/7418b=
b01/attachment.htm


More information about the Catalyst mailing list