[Dbix-class] Duplication of records in many-to-many prefetch

Shea Levy shea.levy at logicblox.com
Wed May 1 22:16:57 GMT 2013


Hi all,

In my project, a user can have multiple roles and multiple users can 
have the same role. The username is the primary key for the users table. 
When I run a query like:

->search({ 'me.username' => $username}, {
       columns => [ "me.fullname", "me.emailaddress", "me.username", 
"userroles.role" ],
       join => "userroles"
     })

for a user with multiple roles, though, I get multiple results for that 
user, each with a different role (rather than one result with multiple 
roles). Is this behavior expected? Is there any way to coalesce these 
separate records into one?

Thanks,
Shea



More information about the DBIx-Class mailing list