[Catalyst] has_many but no left join?!

Stephen Shorrock stephen.shorrock at gmail.com
Tue Jun 18 18:18:37 GMT 2013


That is indeed my plan! I admittedly haven't tried a manual join perhaps as
I was under the impression search related did the same thing. Though
thinking about it now search_related will attempt to return  the related
objects thus not left joining and it it quite possibly the source of my
confusion. Many thanks for your support talking though the problem. I'm
quietly confident it will work tomorrow.

Many thanks
Stephen
On Jun 18, 2013 7:10 PM, "Robert Wohlfarth" <rbwohlfarth at gmail.com> wrote:

> On Tue, Jun 18, 2013 at 12:58 PM, Stephen Shorrock <
> stephen.shorrock at gmail.com> wrote:
>
>> Thanks Robert.
>>
>> I've attempted to extract the relevant relationship from my code, though
>> when i use it i intend to group by and test for a not exists via matchin=
g a
>> null row with the left join.  I really need to have a left join in this
>> relationship. It appears to be working for other has_many relationships =
but
>> not under these circumstances. I wondered whether any knew of any
>> conditions that might prevent it from working.
>>
>> Ah, well then I answered the wrong question :)
>
> How about this code?
> $c->model('MyApp::IndexStatus')->search({'old_statuses.id' =3D>
> undef},{join=3D>'old_statuses'})
>
> From my novice understanding of DBIx::Class, I would expect that to find
> all records from MyApp::IndexStatus that do not have a corresponding row =
in
> old_statuses. The "join" tells the SQL generator to join the tables so th=
at
> you can add conditions about old_statuses. DBIx::Class automatically does=
 a
> LEFT JOIN because the relationship is declared has_many.
>
> --
> Robert Wohlfarth
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20130618/33597=
95d/attachment.htm


More information about the Catalyst mailing list