[EMAIL PROTECTED] wrote:
Based on the Cookbook 'Multi-step joins' section I've tried various variations of:
  join => [ qw/table_2 table_3 table_4 table_5/ ],
  join => [ qw/table_2 table_3/], { 'table_4' => 'table_5' } ],
  join => [ qw/table_2 table_3/], table_1 => { 'table_4' => 'table_5' } ],
  etc.

I think
join => [{ 'table_4' => 'table_5' }, qw/table_2 table_3/]

should work.
No, it doesn't. I know the arrayref generates valid sql as I can extract it from the DBIC::Profiler output and run it manually. It finds the data I want. I have also manually constructed 'from' as a complex data structure (see below), but always the same error: "DBIx::Class::ResultSet::single(): No such relationship 'speciality' at ...."

speciality is the alias for table_5, as in:

from => {
 { me => 'requests' },
 [ # various standard left-joins, then: ],
 [
   { 'speciality' => 'specialities', -join-type => 'left' },
{ 'speciality.id' => table_4.speciality_id' }, # 'speciality.id' now foreign key in table_4
 ],
}

I'm retrieving the data as:
$c->model('Schema::Foo')->search($search_criteria_href, $select_href)->single # it's a single-record search
Then: No such relationship 'speciality', etc

So frustrating!

--
Richard Jones

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to