On Tue, Jun 18, 2013 at 12:58 PM, Stephen Shorrock <
stephen.shorr...@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 matching 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' =>
undef},{join=>'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 that
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@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/

Reply via email to