Project

General

Profile

Actions

Bug #77726

closed

Error when saving an inline CSV relation

Added by Tymoteusz Motylewski about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-08-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

test_category_inline_tree.zip (1.94 KB) test_category_inline_tree.zip Tymoteusz Motylewski, 2016-08-31 18:13
Actions #1

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,
        ],
Actions

Also available in: Atom PDF