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

Steve steve at matsch.com
Wed Aug 4 15:52:33 GMT 2010


On 8/4/2010 10:46 AM, fREW Schmidt wrote:
>
>
> On Wed, Aug 4, 2010 at 7:34 AM, Steve <steve at matsch.com 
> <mailto: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.
>             ...
>
>
>          include the error message please.
>
>     >From memory: No such relationship roles in DCO::Schema::Result::User
>
>
> So to be clear, you are saying that you added the roles many to many 
> in user and you do $user->roles and get that error?
>
> I'm guessing you did something like $user->related_resultset('roles'), 
> which wouldn't work since technically m2m isn't a relationship.
>
That's exactly what I'm doing!  Since I had to get something working I 
took a couple of extra steps,
and got the functionality I was looking for, but I find myself wondering 
what the benefit of having a
'many_to_many' pseudo-relationship is?

Thank you for this explanation, it will keep me sane! :)
> I can't really say more though without seeing actual code and actual 
> errors.
>
> -- 
> fREW Schmidt
> http://blog.afoolishmanifesto.com
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.851 / Virus Database: 271.1.1/3050 - Release Date: 08/04/10 00:45:00
>
>    



More information about the DBIx-Class mailing list