[Dbix-class] Need help with multi-join query

Dennis Daupert ddaupert at sbcglobal.net
Mon May 21 20:44:35 GMT 2007


>I *think* I need to search on photos table, and join galleries
>and tags; but I can't seem to get the syntax right

OK, I answered part of my question. I got this query to 
work, so I'm pretty sure my classes and relations are
good:

 my $photo_obj = [$c->model('CatapultDB::Photos')->search(
                    { 
                     'tags.tag' => "$tag", 
                     },
                    { 
                      join => [qw/ gallery tags /],
                     }
                    )->all];

The problem arises when I try to add paging. This
doesn't work:

  $page = $page || 1;
  my $photo_obj = [$c->model('CatapultDB::Photos')->search(
                      { 
                       'tags.tag' => "$tag", 
                       },
                      { 
                        join => [qw/ gallery tags /],
                       }
                      )->page($page)];

Removing the anonymous array doesn't work either. 

Does anyone have any ideas?

/dennis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070521/d87310bd/attachment.htm


More information about the Dbix-class mailing list