Bug #105277
openCould not convert PHP value 0 to type date. Expected one of the following types: null, string, DateTime
0%
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
\DateTimetypeOfRelation is NONE
\Vendor\Package\Domain\Model\Date\DatetypeOfRelation is HAS_ONE
Updated by ondro no-lastname-given about 1 month ago
Updated by Garvin Hicking about 1 month ago
- Status changed from New to Needs Feedback
Hey,
thank your for sharing the report and a possible fix. Definitely Extbase and some other areas in TYPO3 still have possible issues with "real" date SQL fields (most functionality was aimed at timestamps). So your effort is very welcome in improving this!
Would you be interested to share your patch for TYPO3 along usual contribution guidelines? Then your patch could also be verified with our CI testing setup. (I could do that for you, but if you're interested, that would help us get this better off the ground and see if you may find follow up issues). If so, please check out https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/Quickstart/Index.html#quickstart
Thanks,
Garvin