[Dbix-class] Re: extra condition in join

Marc Logghe logghe.marc at gmail.com
Tue Jul 12 19:47:52 GMT 2011


On Tue, Jul 12, 2011 at 6:42 PM, Marc Logghe <logghe.marc at gmail.com> 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' =3D> 'self.thingy_num', 'foreign.library' =3D=
> {
> '=3D' =3D> $library}},
>   { join_type =3D> '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 =3D shift;

      return {
        "$args->{foreign_alias}.thingy_number" =3D> { -ident =3D>
"$args->{self_alias}.thingy_num" },
        "$args->{foreign_alias}.library"   =3D> { '=3D' =3D> $library},
      };
    }

cheers,
Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20110712/9e5=
19487/attachment.htm


More information about the DBIx-Class mailing list