[Dbix-class] Re: BUG? Unable to resolve relationship

Adam Sjøgren adsj at novozymes.com
Mon Dec 14 18:38:42 GMT 2009

On Sat, 12 Dec 2009 11:27:37 +0100, Peter wrote:

> might_have and has_many produce identical SQL. The difference is how
> the result is interpreted. has_many is a multi-type accessor, so when
> you call ->doodads you get a resultset object from which 0 or more
> objects can be retrieved. If instead you use might_have, calling the
> accessor (which you'll probably call->doodad, instead of doodads) will
> either return a *row* object, or undef. If the sql contains more than
> 1 result, the first one is turned into an object, and the rest of the
> results is discarded with a loud warning.

Thanks for this very clear explanation. It should be shoveled into the
documentation right away!

  Best regards,


                                                          Adam Sjøgren
                                                    adsj at novozymes.com

More information about the DBIx-Class mailing list