Hi,
I am trying to create a might_have join condition in DBIx::Class where I
want to add a value comparison as well as having matching values in the
foreign and self columns. To give an example, suppose I have two tables:
create table foo (
id int not null primary key auto_increment,
etc
)
create table bar (
id int not null primary key auto_increment,
foo_id int not null,
pref boolean not null
etc
)
and I want to generate SQL that looks something like this:
select me.id, bar.id from foo me
left join bar bar on (me.id = bar.foo_id and bar.pref = 1)
etc
I tried creating my might_have relationship with various variations along
this line in Schema::Foo:
__PACKAGE__->might_have(bar => 'Schema::Bar',
{
'foreign.foo_id' => 'self.id',
'foreign.pref' => { '==', '1' },
});
but couldn't find anything that worked - I get an exception thrown like
this:
Invalid rel cond val HASH(0x94a79c)
for all the things I tried. Is this kind of join possible and if so what is
the right syntax?
thanks
Henry
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]