[Dbix-class] Complex table joins

Matt S Trout dbix-class at trout.me.uk
Mon May 21 21:27:11 GMT 2007


On Mon, May 21, 2007 at 08:06:48PM +0100, Richard Jones wrote:
> I also think the problem is that I haven't managed to find a way to 
> define a relationship in Schema::Foo to a table removed by 2 levels:
> 
> foo: id  bar_id
>            |
>            v
> bar:       id  baz_id
>                  |
>                  v
> baz:             id   the_field_I_want

You don't. You define a rel in bar and do

join => { name_of_foo_to_bar_rel => 'name_of_bar_to_baz_rel' }

then $foo->name_of_foo_to_bar_rel->name_of_bar_to_baz_rel->the_field_I_want

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list