[Dbix-class] missing 'many-to-many' relationship

fREW Schmidt frioux at gmail.com
Tue Aug 3 21:41:05 GMT 2010


On Tue, Aug 3, 2010 at 8:04 AM, Steve <steve at matsch.com> wrote:

> Hi all,
> I am bewildered as to why my 'many_to_many' relationship is being ignored.
> I get an error when trying to use the relationship because it 'does not
> exist',
> and clearly it doesn't.  WHY?
> My result classes are 'User.pm', 'Role.pm', and 'UserRole.pm'.
> I'm using the DBIC::Loader to generate the 'has_many', and 'belongs_to'
> relationships, which leaves me to create the 'many_to_many' relationship
> manually.
>
> The User.pm result class relationships:
> (generated by loader)
> __PACKAGE__->has_many("user_roles", "DCO::Schema::Result::UserRole",
>   { "foreign.users_id" =3D> "self.id" });
>
> (written by me)
> __PACKAGE__->many_to_many('roles', 'user_roles', 'role');
>
> I set a breakpoint for the debugger just prior to the 1; at the end of the
> package
> and interrogated the schema. I clearly see that the 'user_roles'
> relationship exists,
> but the 'roles' relationship does not.  No syntax errors, all other
> relationships
> are being used successfully in the schema.
>
> Any clue as to why this relationship is not created?
>
> Thanks as always,
> Steve


 include the error message please.
-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20100803/46f=
84ac4/attachment.htm


More information about the DBIx-Class mailing list