Hi Eden,

On Mon, Dec 20, 2010 at 10:46 AM, Eden Cardim <[email protected]> wrote:

> >>>>> "Bill" == Bill Moseley <[email protected]> writes:
>
>    Bill> That lists the relationships on a source.  And I'm looking for
> join info on a resultset.
>
>    Bill> I resorted to matching either $rs->result_class or using
>    Bill> Data::Visitor on $rs->{attrs}{join} and looking for the
>    Bill> join.  Doesn't seem that sound of a solution, but appears to
>    Bill> be working ok in my initial tests.
>
> Isn't it easier just "cross" the join via ->related_resultset which
> gives you the correct resultset?
>
> ->resultset('CD')->related_resultset('label')->check_deleted;
> ->resultset('CD')->related_resultset('tracks')->check_deleted;
>
> and you'd implement check_deleted() on RS::Label and RS::Track without
> having to know whether 'CD' is joined or not.
>

Sorry, perhaps I am misunderstanding your suggestion.  My question was:

For any resultset "$rs", determine if it's joined to (or selects from) table
"foo", and if so, what is the alias for that table.

The idea is to have a single place that can add in the criteria to all
resultsets that join to a given table.


-- 
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