Issue Bug Closed

#88768l10n_parent as group field breaks backend

Markus Klein 07/15/19, 17:27 updated 12/23/19, 22:45

Description

Editing a translated record, where the l10n_parent is defined as group field in TCA (for performance reasons) leads to an exception in the backend IF the record in this very table with UID 1 does NOT exist.

The reason is the \TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseLanguageRows class which relies on $result['databaseRow']['l10n_parent'] being a string/int.

In case of being defined as group field the l10n_parent is an array since the Form Engine refactoring.
As this $result['databaseRow']['l10n_parent'] is cast to an integer, the class subsequently tries to work on UID 1. (there is always exactly 1 element in the array)

TCA

        'l10n_parent' => [
            'displayCond' => 'FIELD:sys_language_uid:>:0',
            'exclude' => false,
            'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
            'config' => [
                'type' => 'group',
                'internal_type' => 'db',
                'allowed' => 'tx_myext_domain_model_location',
                'size' => 1,
                'maxitems' => 1,
                'minitems' => 0,
            ],
        ],

Error message:

Default language record with id 1 not found in table tx_myext_domain_model_location while editing record 1234@

Reviews 2