[Dbix-class] Bug with relationships on new objects.

Scott Thomson smoothhound at gmail.com
Thu Jan 24 09:28:00 GMT 2008


On Jan 23, 2008 6:01 AM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Tue, Jan 22, 2008 at 12:29:50PM +0000, Scott Thomson wrote:
> > I'm up for writing a test case, I've already got the beginnings of one
> > against which I used to help me locate the cause of the problem.
> > However, I'm not at all sure what is the correct behaviour to assert.
> >
> > I do think that a 'create'd object should have exactly the same
> > external behaviour of an inflated object, which is currently not the
> > case, as to what that behaviour should be I'm not so sure.
>
> How does it differ?
>
> So far as I can tell the question is as to whether the column is present
> or not, which can be true or false whether the object was constructed
> via new() or inflate_result().

Indeed, and this does cause differing external behaviour. Calling the
rel accessor when the object has been created and hence the column is
not set - returns all rows in the foreign table because no WHERE
clause gets generated. Whereas if the same object is inflated - the
column is set to 'undef', a where clause of fk = NULL is generated and
no rows are returned.



More information about the DBIx-Class mailing list