[Dbix-class] Search_related with many_to_many relationship
    Christian Lackas 
    lackas at lackas.net
       
    Wed Jan  7 20:09:26 GMT 2009
    
    
  
* Jason Gottshall <jgottshall at capwiz.com> [090107 19:08]:
Hi Jason,
> I think you can probable use at least one of your many_to_many shortcuts; 
> it's just sugar for two sequential "search_related" calls anyway. Try 
> something like this (untested, of course):
>
>         return $self->roles->search_related( 'map_role_proj',
>             { 'map_role_proj.perm' => $mode },
>             )->search_related(
>             'projects',
>             {},
>             {   distinct => 1,
>                 order_by => 'projectpath',
>             }
>             );
thanks a lot for your help. Works perfectly for me.
Was not aware of how nicely you can chain these commands. My first
project without raw SQL and I'm truly impressed.
Christian
-- 
http://www.spect-ct.com/    Multi-Modality Molecular Imaging
http://www.invicro.com/     In Imaging Yours
http://www.lackas.net/      blub
    
    
More information about the DBIx-Class
mailing list