[Dbix-class] 0.08 Regression?

Christopher H. Laco claco at chrislaco.com
Wed Jun 13 17:57:07 GMT 2007


Christopher H. Laco wrote:
> Adam Herzog wrote:
>> I think I stumbled across a regression while testing RC3. I'm not sure
>> how best to incorporate a test into the suite, but I've put together a
>> minimal case that demonstrates the problem. It works correctly (or at
>> least, as I expect it to) under 0.07006, but not the latest RC.
>>
>> The test scenario contains authors and books, where a book belongs_to an
>> author, and an author has_many books. The problem seems to occur where
>> the foreign key in books has an accessor set, and the relationship has
>> the same name as the actual column name. Somewhere along the line, the
>> column accessor is getting confused with the relationship, I guess.
>>
>> I've included the test files inline below, as well as attached them to
>> the email.
>>
>> -A
> =

> Changeset 3358: "%colinfo accessors and inflate_column now work together"
> =

> I did this one myself. Basically, inflated columns weren't getting set
> to their accessors [instead of colname].
> =

> Since relationships are really inflators, I'd say this is the source of
> the change. I could be wrong.
> =

> =

> Normally, ->author() would return the author field id value. But since
> you've asked it to return an author object via belongs_tom ->author()
> would return the author object.
> =

> Then, you told DBIC to change the accessor from author() to author_id().
> So, author_id() returns the same object that ->author() would have
> because of the belongs_to.
> =

> Let's forget about the accessor option for a moment. Once belongs_to is
> in place, you would always get an author object, never the field value
> itself.
> =

> Seems like the correct behavior to me.
> =

> -=3DChris

And this is a real bug fix, not really a regression. accessors +
inflated columns (or relationships) has never worked correctly together.

https://rt.cpan.org/Ticket/Display.html?id=3D27180

-=3DChris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070613/27=
6ee41e/signature.pgp


More information about the Dbix-class mailing list