On Tue, Jul 12, 2011 at 09:47:52PM +0200, Marc Logghe wrote: > On Tue, Jul 12, 2011 at 6:42 PM, Marc Logghe <[email protected]> wrote: > > > Hi, > > I wanted to add an extra condition in a join like this: > > > > $lite_schema->class('Thingy')->add_relationship( > > "fixed_position", > > "Foo::Bar", > > { 'foreign.thingy_number' => 'self.thingy_num', 'foreign.library' => { > > '=' => $library}}, > > { join_type => 'left outer'} > > ); > > > > > > > OK for the record, checked DBIC::ResultSource and it is not supported. > However, this does the trick if the condition hash is replaced by: > > sub { > my $args = shift; > > return { > "$args->{foreign_alias}.thingy_number" => { -ident => > "$args->{self_alias}.thingy_num" }, > "$args->{foreign_alias}.library" => { '=' => $library}, > }; > }
Just for the sake of people landing here through search - "it" is very well supported, and the above syntax is the official correct way to do this. This method is not a trick, hack or in any other way inferior to the "hash" syntax. Cheers :) _______________________________________________ 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]
