Project

General

Profile

Actions

Bug #105277

open

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

Added by ondro no-lastname-given 5 days ago. Updated 5 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2024-10-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.3
Tags:
extbase, columnMap
Complexity:
medium
Is Regression:
Sprint Focus:

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
typeOfRelation is NONE
\Vendor\Package\Domain\Model\Date\Date
typeOfRelation is HAS_ONE
Actions

Also available in: Atom PDF