Issue Bug Closed

#95513SQL error: 'Incorrect integer value: '' for column 'grade' at row 1'

Xavier Perseguers 10/07/21, 07:28 updated 06/12/24, 10:41

Description

Having this definition:

        'grade' => [
            'exclude' => true,
            'label' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:tx_myext_domain_model_location.grade',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    ['', 0],
                ],
                'foreign_table' => 'tx_myext_domain_model_grade',
                'foreign_table_where' => 'ORDER BY tx_myext_domain_model_grade.name',
            ],
        ],

One can properly choose a “grade” in the selector and persist it. But as soon as the default empty option is selected (0), persisting the record fails with:

SQL error: 'Incorrect integer value: '' for column 'grade' at row 1' (tx_myext_domain_model_location:1)

Somehow the 0 is detected as “empty” and transformed into an empty string when sent to the database.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.