Skip to content

Commit

Permalink
[BUGFIX] Let import handle missing TCA for file relations better
Browse files Browse the repository at this point in the history
If a file relation's field config is missing the import now adds an
error that makes identifying the broken TCA possible.

Resolves: #103282
Releases: main, 12.4
Change-Id: I622b98fc256df2a994f0ff1477aebdd9b3953a4d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83400
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
  • Loading branch information
pschriner authored and lolli42 committed Mar 11, 2024
1 parent b3ee9ba commit d0c1c3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions typo3/sysext/impexp/Classes/Import.php
Expand Up @@ -1203,8 +1203,12 @@ protected function setRelations(): void
case 'db':
if (is_array($relation['itemArray'] ?? null) && !empty($relation['itemArray'])) {
$fieldTca = &$GLOBALS['TCA'][$table]['columns'][$field];
$actualRelations = $this->remapRelationsOfField($relation['itemArray'], $fieldTca['config'], $field);
$updateData[$table][$actualUid][$field] = implode(',', $actualRelations);
if (is_array($fieldTca['config'])) {
$actualRelations = $this->remapRelationsOfField($relation['itemArray'], $fieldTca['config'], $field);
$updateData[$table][$actualUid][$field] = implode(',', $actualRelations);
} else {
$this->addError(sprintf('Error: Missing TCA "config" for field "%s:%s"', $table, $field));
}
}
break;
case 'file':
Expand Down

0 comments on commit d0c1c3f

Please sign in to comment.