[TYPO3-mvc] Should a DateTime field with an empty value be saved as 0 ?

Laurent Foulloy yolf.typo3 at orange.fr
Sat Aug 7 22:55:16 CEST 2010


Hi,

When a DateTime field with an empty value is input, it is not saved in 
the database and the previous saved value is returned.
In order to have the same behaviour as in the backend, a zero value 
should be saved.

I do not know if it is a bug or the regular expected behaviour.

If it is a bug, it can be simply corrected by changing:

if ($propertyValue === '') {
   $propertyValue = NULL;
} else {

into

if ($propertyValue === '') {
   $propertyValue = 0;
} else {

in transformToObject() in the class Tx_Extbase_Property_Mapper.

Doing so will avoid the field to be skipped in map().

Regards

Laurent


More information about the TYPO3-project-typo3v4mvc mailing list