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

Peter Rabbitson rabbit+dbic at rabbit.us
Tue Dec 15 10:10:20 GMT 2009


Adam Sjøgren wrote:
> 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!
> 

Implementors usually suck at writing wholesome documentation. Could you
be so kind to submit a patch against [1]. You will have both a better
idea where to put the text so a user will find it, and also how to word
such text so it makes sense to a novice.

Thanks!

[1] http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/



More information about the DBIx-Class mailing list