Project

General

Profile

Actions

Bug #87781

closed

TCA type='none' throws InvalidFieldNameException when saving translated record

Added by Georg Tiefenbrunn about 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2019-02-25
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I've added a field help with TCA type='none' to display some custom help text in the Backend.

$GLOBALS['TCA']['tt_content']['columns']['help'] = [
    'label' => 'Help',
    'l10n_mode' => 'exclude',
    'config' => [
        'type' => 'none',
        'renderType' => 'myCustomHelpRenderType',
    ],
];

Records in default language just work as expected.
Translated records can't be saved:

Doctrine\DBAL\Exception\InvalidFieldNameException: ... Unknown column 'help' in 'field list'

Current behavior: DataHandler tries to synch the type='none' field with TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor->synchronizeTranslationItem().

Expected behavior (see TCAReference https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/None.html):

  • The DataHandler discards values send for type none and never persists or updates them in the database.
  • Type none is the only type that does not necessarily need a database field.

Quick and dirty "fix": Add the database field (tt_content.help).

Actions #1

Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61960

Actions #2

Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61960

Actions #3

Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61960

Actions #4

Updated by Oliver Hader over 4 years ago

Why is l10n_mode set in the first place on a value that shall not be persisted?
Probably displayCond was meant to avoid showing this field on localized records, correct?

Actions #5

Updated by Georg Tiefenbrunn over 4 years ago

Oliver Hader wrote:

Probably displayCond was meant to avoid showing this field on localized records, correct?

Correct, thanks a lot!

https://docs.typo3.org/m/typo3/reference-tca/master/en-us/Columns/Index.html#l10n-mode

exclude Field will not be shown in FormEngine if this record is a localization of the default language. Works basically like a display condition. Internally, the field value of the default language record is copied over to the field of the localized record. ...

What's next?

a) Don't set 'l10n_mode' => 'exclude' for 'type' => 'none' (= Update the docs)
b) Force DataHandler to discard data if 'type' => 'none' (= The DataHandler discards values send for type none and never persists or updates them in the database.)

Actions #6

Updated by Gerrit Code Review about 4 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62980

Actions #7

Updated by Christian Eßl about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF