BTW -

On Wed, May 12, 2010 at 9:48 AM, Peter Rabbitson
<[email protected]<rabbit%[email protected]>
> wrote:

> > Then can do this:
> >
> > my $artist_rs = $schema->resultset('Artist')->search(
> >     { 'me.id <http://me.id>' => $id },
> >     { join => 'label' },
> >  )
> >
> > $artist_rs = add_label_check( $artist_rs );  # add in access checks
> >
> > All that's needed is to set the join condition up to label.
>
> Why?
>
> my $new_rs = $rs->search ({ 'label.disabled' => 0}, { join => 'label' });
>


Are you asking why I have to pass in the join condition?  Because the passed
in $rs might be for an Artist and then it's { join => 'label' }, but if the
passed in $rs is for a Track then it's { join => { cd => { artist => 'label'
} } }.

Is there another way?  I'd love to not pass in the join and have the code
say "Hey, I've got a Track resultset, so I need to do this join to get from
Track to Label".


-- 
Bill Moseley
[email protected]
_______________________________________________
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/[email protected]

Reply via email to