[TYPO3-mvc] RFC #8973: DataMapper mapps FALSE into empty related property

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jul 21 12:15:49 CEST 2010


Hey Felix,

> Type: Bugfix
>
> Bugtracker references:
> http://forge.typo3.org/issues/8973
>
> Branches:
> trunk, 1.2.0
>
> Problem:
> When you've got a model with a property holding an related object,
> extbase tries to find the corresponding row in the database (via
> DataMapper::fetchRelatedEager() and the query-object). If there is no
> such row (because it either does not exist or it is flagged hidden or
> deleted), the query-object will return an empty array.
>
> The DataMapper will then give this empty array to
> DataMapper::mapResultToPropertyValue(). In line 451 current() is called
> on this empty array and the result is assigned as propertyValue.
> Unfortunately current() returns FALSE on an empty array. You end up with
> the property's value set to FALSE if the related object was not found.
>
> Solution:
> I would suggest to map NULL here, because it's an empty property
> (without the corresponding object).

+1 on reading

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list