[Dbix-class] wishlist: "might_have_many"

Mike Rylander mrylander at gmail.com
Thu Apr 13 04:53:16 CEST 2006


On 4/12/06, Mark Hedges <hedges at ucsd.edu> wrote:
>
> I found that if I do a prefetch on a Foo RS to its have_many
> Bar, but it doesn't have any Bars, I don't get the Foo at all.
>
> This is similar to a problem where if I do a prefetch from one
> to another with a 1:1 relationship, but the other doesn't exist,
> it does not work if I defined with has_one but it does work if I
> defined if might_have.
>
> However there isn't a fix for a 1:N relationship.  (Doesn't 1:N
> imply that N could equal 0?)  Instead I have to remember where
> this drop might occur and I get no object, and I can't prefetch.
>

Sounds like has_many should use LEFT JOIN ... [he says, sniping from
the sidelines having not looked at the code]

--
Mike Rylander
mrylander at gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org



More information about the Dbix-class mailing list