TcaMigration

class \TYPO3\CMS\Core\Migrations\TcaMigration

Migrate TCA from old to new syntax. Used in bootstrap and Flex Form Data Structures.

Table of Contents

Properties

$messages  : array
Accumulate migration messages

Methods

getMessages()  : array
Get messages of migrated fields. Can be used for deprecation messages after migrate() was called.
migrate()  : array
Run some general TCA validations, then migrate old TCA to new TCA.
migrateAuthMode()  : array
See if ['columns'][aField]['config']['authMode'] is not set to 'explicitAllow' and set it to this value if needed.
migrateColumnsConfig()  : array
Find columns fields that don't have a 'config' section at all, add ['config']['type'] = 'none'; for those to enforce config
migrateEmailFlagToEmailType()  : array
Migrates [config][eval] = 'email' to [config][type] = 'email' and removes 'email' from [config][eval].
migrateEvalIntAndDouble2ToTypeNumber()  : array
Migrates [config][eval] = 'int' and [config][eval] = 'double2' to [config][type] = 'number'.
migrateFalHandlingInInlineToTypeFile()  : array
Migrates type='inline' with foreign_table='sys_file_reference' to type='file'.
migrateFileFolderConfiguration()  : array
Moves the "fileFolder" configuration of TCA columns type=select into sub array "fileFolderConfig", while renaming those options.
migrateInternalTypeFolderToTypeFolder()  : array
Migrates [config][internal_type] = 'folder' to [config][type] = 'folder'.
migrateItemsToAssociativeArray()  : array
Converts the item list of type "select", "radio" and "check" to an associated array.
migrateLanguageFieldToTcaTypeLanguage()  : array
Replaces $TCA[$mytable][columns][$TCA[$mytable][ctrl][languageField]][config] with $TCA[$mytable][columns][$TCA[$mytable][ctrl][languageField]][config][type] = 'language'
migrateLevelLinksPosition()  : array
The [appearance][levelLinksPosition] option can be used to select the position of the level links. This option was previously misused to disable all those links by setting it to "none". Since all of those links can be disabled by a dedicated option, e.g. showNewRecordLink, this wizard sets those options to false and unsets the invalid levelLinksPosition value.
migrateNullFlag()  : array
Migrates [config][eval] = 'null' to [config][nullable] = true and removes 'null' from [config][eval].
migratePagesLanguageOverlayRemoval()  : array
Removes $TCA['pages_language_overlay'] if defined.
migratePasswordAndSaltedPasswordToPasswordType()  : array
Migrates [config][eval] = 'password' and [config][eval] = 'saltedPassword' to [config][type] = 'password' Sets option "hashed" to FALSE if "saltedPassword" is not set for "password" Removes option [config][eval].
migrateRenderTypeColorpickerToTypeColor()  : array
Migrates [config][renderType] = 'colorpicker' to [config][type] = 'color'.
migrateRenderTypeInputDateTimeToTypeDatetime()  : array
Migrates [config][renderType] = 'inputDateTime' to [config][type] = 'datetime'.
migrateRenderTypeInputLinkToTypeLink()  : array
Migrates [config][renderType] = 'inputLink' to [config][type] = 'link'.
migrateRequiredFlag()  : array
Migrates [config][eval] = 'required' to [config][required] = true and removes 'required' from [config][eval].
migrateRootUidToStartingPoints()  : array
If a column has [treeConfig][rootUid] defined, migrate to [treeConfig][startingPoints] on the same level.
migrateSpecialLanguagesToTcaTypeLanguage()  : array
Replaces $TCA[$mytable][columns][field][config][special] = 'languages' with $TCA[$mytable][columns][field][config][type] = 'language'
migrateTypeNoneColsToSize()  : array
Migrates type => "none" [config][cols] to [config][size] and removes "cols".
removeAllowLanguageSynchronizationFromColumnsOverrides()  : array
Setting "allowLanguageSynchronization" for columns via columnsOverride is currently not supported see Localization\State and therefore leads to an exception in the LocalizationStateSelector wizard.
removeAlwaysDescription()  : array
Removes ['interface']['always_description'] and also ['interface'] if `always_description` was the only key in the array.
removeAuthModeEnforce()  : array
Remove ['columns'][aField]['config']['authMode_enforce']
removeCtrlCruserId()  : array
Remove ['ctrl']['cruser_id'].
removeEnableMultiSelectFilterTextfieldConfiguration()  : array
Removes configuration removeEnableMultiSelectFilterTextfield
removeExcludeFieldForTransOrigPointerField()  : array
Removes $TCA[$mytable][columns][_transOrigPointerField_][exclude] if defined
removeFalRelatedElementBrowserOptions()  : array
Removes the [appearance][elementBrowserType] and [appearance][elementBrowserAllowed] options from TCA type "group" fields.
removeFalRelatedOptionsFromTypeInline()  : array
Removes the following options from TCA type "inline" fields: - [appearance][headerThumbnail] - [appearance][fileUploadAllowed] - [appearance][fileByUrlAllowed]
removeMmInsertFields()  : array
removePassContentFromTypeNone()  : array
Removes ['config']['pass_content'] from TCA type "none" fields
removeSelectAuthModeIndividualItemsKeyword()  : array
If a column has authMode=individual and items with the corresponding key on position 5 defined, or if EXPL_ALLOW or EXPL_DENY is set for position 6, migrate or remove them.
removeSelIconFieldPath()  : array
Removes $TCA[$mytable][ctrl][selicon_field_path]
removeSetToDefaultOnCopy()  : array
Removes $TCA[$mytable][ctrl][setToDefaultOnCopy]
removeShowRecordFieldListField()  : array
Removes $TCA[$mytable]['interface']['showRecordFieldList'] and also $TCA[$mytable]['interface'] if `showRecordFieldList` was the only key in the array.
removeShowRemovedLocalizationRecords()  : array
removeWorkspacePlaceholderShadowColumnsConfiguration()  : array
Removes $TCA[$mytable][ctrl][shadowColumnsForMovePlaceholders] and $TCA[$mytable][ctrl][shadowColumnsForNewPlaceholders]
sanitizeControlSectionIntegrity()  : array
Ensures that system internal columns that are required for data integrity (e.g. localize or copy a record) are available in case they have been defined in $GLOBALS['TCA'][<table-name>]['ctrl'].
validateTcaType()  : mixed
Check for required TCA configuration

Properties

$messages

Accumulate migration messages

protected array $messages = []

Methods

getMessages()

Get messages of migrated fields. Can be used for deprecation messages after migrate() was called.

public getMessages() : array

Return values

array —

Migration messages

migrate()

Run some general TCA validations, then migrate old TCA to new TCA.

public migrate(array $tca) : array

This class is typically called within bootstrap with empty caches after all TCA files from extensions have been loaded. The migration is then applied and the migrated result is cached. For flex form TCA, this class is called dynamically if opening a record in the backend.

See unit tests for details.

Parameters

$tca : array

Return values

array

migrateAuthMode()

See if ['columns'][aField]['config']['authMode'] is not set to 'explicitAllow' and set it to this value if needed.

protected migrateAuthMode(array $tca) : array

Parameters

$tca : array

Return values

array

migrateColumnsConfig()

Find columns fields that don't have a 'config' section at all, add ['config']['type'] = 'none'; for those to enforce config

protected migrateColumnsConfig(array $tca) : array

Parameters

$tca : array

Incoming TCA

Return values

array

migrateEmailFlagToEmailType()

Migrates [config][eval] = 'email' to [config][type] = 'email' and removes 'email' from [config][eval].

protected migrateEmailFlagToEmailType(array $tca) : array

If [config][eval] contains 'trim', it will also be removed. If [config][eval] becomes empty, the option will be removed completely.

Parameters

$tca : array

Return values

array

migrateEvalIntAndDouble2ToTypeNumber()

Migrates [config][eval] = 'int' and [config][eval] = 'double2' to [config][type] = 'number'.

protected migrateEvalIntAndDouble2ToTypeNumber(array $tca) : array

The migration only applies to fields without a renderType defined. Adds [config][format] = "decimal" if [config][eval] = double2 Removes [config][eval]. Removes option [config][max], if set.

Parameters

$tca : array

Return values

array

migrateFalHandlingInInlineToTypeFile()

Migrates type='inline' with foreign_table='sys_file_reference' to type='file'.

protected migrateFalHandlingInInlineToTypeFile(array $tca) : array

Removes table relation related options. Removes no longer available appearance options. Detects usage of "customControls" hook. Migrates renamed appearance options. Migrates allowed file extensions.

Parameters

$tca : array

Return values

array

migrateFileFolderConfiguration()

Moves the "fileFolder" configuration of TCA columns type=select into sub array "fileFolderConfig", while renaming those options.

protected migrateFileFolderConfiguration(array $tca) : array

Parameters

$tca : array

Return values

array

migrateInternalTypeFolderToTypeFolder()

Migrates [config][internal_type] = 'folder' to [config][type] = 'folder'.

protected migrateInternalTypeFolderToTypeFolder(array $tca) : array

Also removes [config][internal_type] completely, if present.

Parameters

$tca : array

Return values

array

migrateItemsToAssociativeArray()

Converts the item list of type "select", "radio" and "check" to an associated array.

protected migrateItemsToAssociativeArray(array $tca) : array

// From: [ 0 => 'A label', 1 => 'value', 2 => 'icon-identifier', 3 => 'group1', 4 => 'a custom description' ]

// To: [ 'label' => 'A label', 'value' => 'value', 'icon' => 'icon-identifier', 'group' => 'group1', 'description' => 'a custom description' ]

Parameters

$tca : array

Return values

array

migrateLanguageFieldToTcaTypeLanguage()

Replaces $TCA[$mytable][columns][$TCA[$mytable][ctrl][languageField]][config] with $TCA[$mytable][columns][$TCA[$mytable][ctrl][languageField]][config][type] = 'language'

protected migrateLanguageFieldToTcaTypeLanguage(array $tca) : array

Parameters

$tca : array

Return values

array

migrateLevelLinksPosition()

The [appearance][levelLinksPosition] option can be used to select the position of the level links. This option was previously misused to disable all those links by setting it to "none". Since all of those links can be disabled by a dedicated option, e.g. showNewRecordLink, this wizard sets those options to false and unsets the invalid levelLinksPosition value.

protected migrateLevelLinksPosition(array $tca) : array

Parameters

$tca : array

Return values

array

migrateNullFlag()

Migrates [config][eval] = 'null' to [config][nullable] = true and removes 'null' from [config][eval].

protected migrateNullFlag(array $tca) : array

If [config][eval] becomes empty, it will be removed completely.

Parameters

$tca : array

Return values

array

migratePagesLanguageOverlayRemoval()

Removes $TCA['pages_language_overlay'] if defined.

protected migratePagesLanguageOverlayRemoval(array $tca) : array

Parameters

$tca : array

Return values

array —

the modified TCA structure

migratePasswordAndSaltedPasswordToPasswordType()

Migrates [config][eval] = 'password' and [config][eval] = 'saltedPassword' to [config][type] = 'password' Sets option "hashed" to FALSE if "saltedPassword" is not set for "password" Removes option [config][eval].

protected migratePasswordAndSaltedPasswordToPasswordType(array $tca) : array

Removes option [config][max], if set. Removes option [config][search], if set.

Parameters

$tca : array

Return values

array

migrateRenderTypeColorpickerToTypeColor()

Migrates [config][renderType] = 'colorpicker' to [config][type] = 'color'.

protected migrateRenderTypeColorpickerToTypeColor(array $tca) : array

Removes [config][eval]. Removes option [config][max], if set.

Parameters

$tca : array

Return values

array

migrateRenderTypeInputDateTimeToTypeDatetime()

Migrates [config][renderType] = 'inputDateTime' to [config][type] = 'datetime'.

protected migrateRenderTypeInputDateTimeToTypeDatetime(array $tca) : array

Migrates "date", "time" and "timesec" from [config][eval] to [config][format]. Removes option [config][eval]. Removes option [config][max], if set. Removes option [config][format], if set. Removes option [config][default], if the default is the native "empty" value

Parameters

$tca : array

Return values

array

Migrates [config][renderType] = 'inputLink' to [config][type] = 'link'.

protected migrateRenderTypeInputLinkToTypeLink(array $tca) : array

Migrates the [config][fieldConfig][linkPopup] to type specific configuration. Removes option [config][eval]. Removes option [config][max], if set. Removes option [config][softref], if set to "typolink".

Parameters

$tca : array

Return values

array

migrateRequiredFlag()

Migrates [config][eval] = 'required' to [config][required] = true and removes 'required' from [config][eval].

protected migrateRequiredFlag(array $tca) : array

If [config][eval] becomes empty, it will be removed completely.

Parameters

$tca : array

Return values

array

migrateRootUidToStartingPoints()

If a column has [treeConfig][rootUid] defined, migrate to [treeConfig][startingPoints] on the same level.

protected migrateRootUidToStartingPoints(array $tca) : array

Parameters

$tca : array

Return values

array

migrateSpecialLanguagesToTcaTypeLanguage()

Replaces $TCA[$mytable][columns][field][config][special] = 'languages' with $TCA[$mytable][columns][field][config][type] = 'language'

protected migrateSpecialLanguagesToTcaTypeLanguage(array $tca) : array

Parameters

$tca : array

Return values

array

migrateTypeNoneColsToSize()

Migrates type => "none" [config][cols] to [config][size] and removes "cols".

protected migrateTypeNoneColsToSize(array $tca) : array

Parameters

$tca : array

Return values

array

removeAllowLanguageSynchronizationFromColumnsOverrides()

Setting "allowLanguageSynchronization" for columns via columnsOverride is currently not supported see Localization\State and therefore leads to an exception in the LocalizationStateSelector wizard.

protected removeAllowLanguageSynchronizationFromColumnsOverrides(array $tca) : array

Therefore, the setting is removed for now and the integrator is informed accordingly.

Parameters

$tca : array

Return values

array

removeAlwaysDescription()

Removes ['interface']['always_description'] and also ['interface'] if `always_description` was the only key in the array.

protected removeAlwaysDescription(array $tca) : array

Parameters

$tca : array

Return values

array

removeAuthModeEnforce()

Remove ['columns'][aField]['config']['authMode_enforce']

protected removeAuthModeEnforce(array $tca) : array

Parameters

$tca : array

Return values

array

removeCtrlCruserId()

Remove ['ctrl']['cruser_id'].

protected removeCtrlCruserId(array $tca) : array

Parameters

$tca : array

Return values

array

removeEnableMultiSelectFilterTextfieldConfiguration()

Removes configuration removeEnableMultiSelectFilterTextfield

protected removeEnableMultiSelectFilterTextfieldConfiguration(array $tca) : array

Parameters

$tca : array

Return values

array —

the modified TCA structure

removeExcludeFieldForTransOrigPointerField()

Removes $TCA[$mytable][columns][_transOrigPointerField_][exclude] if defined

protected removeExcludeFieldForTransOrigPointerField(array $tca) : array

Parameters

$tca : array

Return values

array

removeFalRelatedElementBrowserOptions()

Removes the [appearance][elementBrowserType] and [appearance][elementBrowserAllowed] options from TCA type "group" fields.

protected removeFalRelatedElementBrowserOptions(array $tca) : array

Parameters

$tca : array

Return values

array

removeFalRelatedOptionsFromTypeInline()

Removes the following options from TCA type "inline" fields: - [appearance][headerThumbnail] - [appearance][fileUploadAllowed] - [appearance][fileByUrlAllowed]

protected removeFalRelatedOptionsFromTypeInline(array $tca) : array

Parameters

$tca : array

Return values

array

removeMmInsertFields()

protected removeMmInsertFields(array $tca) : array

Parameters

$tca : array

Return values

array

removePassContentFromTypeNone()

Removes ['config']['pass_content'] from TCA type "none" fields

protected removePassContentFromTypeNone(array $tca) : array

Parameters

$tca : array

Return values

array

removeSelectAuthModeIndividualItemsKeyword()

If a column has authMode=individual and items with the corresponding key on position 5 defined, or if EXPL_ALLOW or EXPL_DENY is set for position 6, migrate or remove them.

protected removeSelectAuthModeIndividualItemsKeyword(array $tca) : array

Parameters

$tca : array

Return values

array

removeSelIconFieldPath()

Removes $TCA[$mytable][ctrl][selicon_field_path]

protected removeSelIconFieldPath(array $tca) : array

Parameters

$tca : array

Return values

array —

the modified TCA structure

removeSetToDefaultOnCopy()

Removes $TCA[$mytable][ctrl][setToDefaultOnCopy]

protected removeSetToDefaultOnCopy(array $tca) : array

Parameters

$tca : array

Return values

array —

the modified TCA structure

removeShowRecordFieldListField()

Removes $TCA[$mytable]['interface']['showRecordFieldList'] and also $TCA[$mytable]['interface'] if `showRecordFieldList` was the only key in the array.

protected removeShowRecordFieldListField(array $tca) : array

Parameters

$tca : array

Return values

array

removeShowRemovedLocalizationRecords()

protected removeShowRemovedLocalizationRecords(array $tca) : array

Parameters

$tca : array

Return values

array

removeWorkspacePlaceholderShadowColumnsConfiguration()

Removes $TCA[$mytable][ctrl][shadowColumnsForMovePlaceholders] and $TCA[$mytable][ctrl][shadowColumnsForNewPlaceholders]

protected removeWorkspacePlaceholderShadowColumnsConfiguration(array $tca) : array

Parameters

$tca : array

Return values

array —

the modified TCA structure

sanitizeControlSectionIntegrity()

Ensures that system internal columns that are required for data integrity (e.g. localize or copy a record) are available in case they have been defined in $GLOBALS['TCA'][<table-name>]['ctrl'].

protected sanitizeControlSectionIntegrity(array $tca) : array

The list of references to usages below is not necessarily complete.

Parameters

$tca : array

Tags

see
DataHandler::fillInFieldArray()

Return values

array

validateTcaType()

Check for required TCA configuration

protected validateTcaType(array $tca) : mixed

Parameters

$tca : array

Incoming TCA

On this page