Project

General

Profile

Actions

Bug #100649

open

Extbase DataMapper doesn't respect datetime when 0 or 0000-00-00 or 0000-00-00 00:00:00 or 00:00:00

Added by Sebastien Convers about 1 year ago. Updated 11 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2023-04-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:
Stabilization Sprint

Description

When using TCA to set an input to datetime or time, like in the documentation (https://docs.typo3.org/m/typo3/reference-tca/11.5/en-us/ColumnsConfig/Type/Input/DateTime/Properties/DbType.html#time-picker-stored-in-a-datetime-field)

'synced_at' => [
   'config' => [
      'type' => 'input',
      'dbType' => 'time',
      'eval' => 'time,null',
   ],
],

The "core" part is working fine, you can set your field to null or midnight (00:00:00)

But then this line in extbase (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php#L315) change it to null no matter what, so you cannot know if your time property is not set (null) or midnight (00:00:00)

// Invalid values are converted to NULL
if (empty($value) || $value === '0000-00-00' || $value === '0000-00-00 00:00:00' || $value === '00:00:00') {
    return null;
}

A workaround is to change the type of your property to string, and use an extra getter method to make the conversion yourself.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99847: Null value for time field is ignored in BEResolved2023-02-06

Actions
Actions #1

Updated by Sebastien Convers about 1 year ago

  • Related to Bug #99847: Null value for time field is ignored in BE added
Actions #2

Updated by Benni Mack 11 months ago

  • Sprint Focus set to Stabilization Sprint
Actions

Also available in: Atom PDF