[Dbix-class] Thoughts about "complex" searches.

Matt S Trout dbix-class at trout.me.uk
Wed Dec 7 03:00:45 CET 2005


On Wed, Dec 07, 2005 at 12:13:14AM +0100, David Kamholz wrote:
> You should be able to do:
> 
> my $rs = Track->search({ 'artist.birth' => { '<', $date } }, { join  
> => 'artist' });
> 
> Where 'artist' is the name of the relationship in the Track class.

and add prefetch => 'artist' to the attr hash and it'll JOIN across the
relationship to the artist table and your $track objects will come with
$track->artist pre-populated.

If you got told to use a view then I suspect either your explanation
of the query didn't come across clearly or quicksilver hadn't had enough
coffee yet ...

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list