i've got three tables: grp_org which has_many grp_own which has_many groups

i'm trying to create a data stricture which should have the data in a reasonable form. i can do the join from grp_org to grp_own fine, but when i try to join to groups, i'm failing.

what i have / tried:

my $grporg_rs = $schema->resultset('GrpOrg'); my $thing = [ $grporg_rs->search_rs( { }, { result_class => 'DBIx::Class::Re +sultClass::HashRefInflator', select => [ qw/me.org grp_ +own.owner/ ], join => 'grp_own', } )->search_rs( { }, { select => [ qw/groups.name +/ ], join => 'groups' } )->all ]; </cod> <p>i've also tried to use ->search_related. my schema looks like: <code> GrpOrg.pm: __PACKAGE__->has_many( "grp_own", "Nais::Schema::Result::GrpOwn", { "foreign.org_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); GrpOwn.pm: __PACKAGE__->has_many( "groups", "Nais::Schema::Result::Group", { "foreign.own_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->belongs_to( "grp_org", "Nais::Schema::Result::GrpOrg", { id => "org_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" + }, ); Groups.pm: __PACKAGE__->has_many( "grp2ais", "Nais::Schema::Result::Grp2ai", { "foreign.gpk" => "self.gpk" }, { cascade_copy => 0, cascade_delete => 0 }, );

In reply to dbic multiple joins by ag4ve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.