Bug #77726
closedError when saving an inline CSV relation
0%
Description
If I try to save a new record in the inline relation
I'm getting an error:
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'UPDATE `sys_category` SET `related_category` = ? WHERE `uid` = ?' with params ["", 304]: Incorrect integer value: '' for column 'related_category' at row 1 in vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115
Steps to reproduce:
- install attached test extension
- then edit sys_category
- add an inline child - in the related category field
- try to save it
TCA for the related category field looks like:
'related_category' => array( 'label' => 'Related category (1. add relation, 2. "Parent" category tree is missing)', 'config' => array( 'type' => 'inline', 'foreign_table' => 'sys_category', ),
Files
Updated by Morton Jonuschat about 8 years ago
- Status changed from New to Closed
This is a bug in the test extension in combination with MySQL strict mode and not related to TYPO3 core. The problem is that the database field is an INT type and the TCA doesn't provide any default value (so an empty value is used in PHP). This results in MySQL complaining that an empty string is not an integer value (only in strict mode). So the fix is to actually provide the correct default value for the field in TCA like this:
'config' => [ 'type' => 'inline', 'foreign_table' => 'sys_category', 'default' => 0, ],