Issue Bug Closed

#105277Could not convert PHP value 0 to type date. Expected one of the following types: null, string, DateTime

ondro no-lastname-given 10/11/24, 12:47 updated 12/02/25, 14:32

Description

I have have extbase model with following property:

    /**
     * @var \Vendor\Package\Domain\Model\Date\Date
     */
    protected $phase = null;
\Vendor\Package\Domain\Model\Date\Date extends \DateTime

Phase TCA config looks as follow:

         'phase' => [
            'label' => 'Phase',
            'config' => [
                'type' => 'datetime',
                'dbType' => 'date',
                'format' => 'date',
            ],
        ],
MySQL:
phase1_start date DEFAULT NULL,

On the first model save and DB insert following error occurs:

Causes error: Could not convert PHP value 0 to type date. Expected one of the following types: null, string, DateTime

I found out problem lays here: https://github.com/TYPO3/typo3/blob/v12.4.21/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/ColumnMapFactory.php#L101

\DateTime
\Vendor\Package\Domain\Model\Date\Date

Reviews 1