[Dbix-class] Re: Testing for a join

Eden Cardim edencardim at gmail.com
Mon Dec 20 18:46:36 GMT 2010


>>>>> "Bill" == Bill Moseley <moseley at hank.org> 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.

-- 
     Eden Cardim            Need help with your perl Catalyst or DBIx::Class project?
   Software Engineer                   http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.        Want a managed development or deployment platform?
http://blog.edencardim.com             http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list