Re: Feature request - Allow searching columns of related tables in search() and search_like()

[prev] [thread] [next] [Date index for 2005/01/10]

From: Matt S Trout
Subject: Re: Feature request - Allow searching columns of related tables in search() and search_like()
Date: 19:47 on 10 Jan 2005
On Mon, Jan 10, 2005 at 07:12:42PM +0000, Tony Bowden wrote:
> On Mon, Jan 10, 2005 at 06:33:31PM +0000, Matt S Trout wrote:
> > It'd also be really nice if ->search allowed you to specify constraints on
> > multiple tables and automatically did the appropriate joins to allow this.
> 
> What would the syntax for this look like?

My current Evil Hack(tm) to allow this expects 'moniker.field' as the key to
the ->search method - e.g.

Foo::Bar->search( 'barness' => 3, # defaults to current table
                  'baz.blue' => 1); # To search a field on related Foo::Baz

but that's possibly a bad idea. Maybe using the name of the relationship
would be better.

I also wonder whether you might want ['baz' => 'blue'], but that would leave
you unable to pass a hashref of params instead of an array, which doesn't
seem like a good idea.

        -- 
        Bring me my etherkiller; Oh clouds unfold! / Bring me the magic smoke of desire
I shall not cease from mental fight / Nor shall my LART rest in my hand
Till we have buried the bodies / Of all the lusers in all this land
  -- rpg, ASR                        [ My homepage is http://www.trout.me.uk/ ]

(message missing)

Re: Feature request - Allow searching columns of related tables in search() and search_like()
Matt S Trout 19:47 on 10 Jan 2005

Generated at 12:48 on 22 Feb 2005 by mariachi v0.52