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

Jochen Rau jochen.rau at typoplanet.de
Wed Jul 21 13:17:53 CEST 2010


Hi Felix.

On 2010-07-21, Franz Koch <typo3.RemoveForMessage at elements-net.de> wrote:
>> 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

+1 by reading and testing.

Ready to be comitted. Thanks. Go ahead ;-)

Jochen


More information about the TYPO3-project-typo3v4mvc mailing list