[Dbix-class] Help with relationships

Jonathan Rockway jon at jrock.us
Fri Apr 11 03:07:02 BST 2008


* On Thu, Apr 10 2008, Shane Corgatelli wrote:
> I'm doing something similar:
>
>    $results = $schema->resultset('Resource')->find('X300002', 1, 1)
>      ->recurrence
>        ->search_related('dates');

DBIC could probably "optimize" this (different input, same programmer
intentions), but in the mean time:

  $schema->resultset('Resource')->
      search({  X3000002 ... })->
      related_resultset('recurrence')->
      related_resultset('dates');

This keeps the row object out of the picture (introduced by find in your
code), which probably saves a trip to the database.

Regards,
Jonathan Rockway      

-- 
print just => another => perl => hacker => if $,=$"



More information about the DBIx-Class mailing list