Skip to content

Commit a32930c

Browse files
committed
[BUGFIX] Handle parent is roottree while checking pointerSubFieldName
* Checking if we leveled up till roottree without finding configured pointer field * Generate complete empty DataStructure for "no DS found" as TYPO3 core do not check correctly for existence. Resolve: #631 Release: 12.1.0
1 parent 4183801 commit a32930c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Classes/Configuration/FlexForm/ParsingModifyEventListener.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ public function initializeDataStructureIdentifier(BeforeFlexFormDataStructureIde
6464
while (!$pointerValue) {
6565
$uidOfHandle = $row['uid'] ?? 'new_' . $row['t3_origuid'];
6666
$handledUids[$uidOfHandle] = 1;
67+
68+
$parentUid = (int) $row[$parentFieldName];
69+
if ($parentUid === 0) {
70+
// We are on TreeRootElement => Leave
71+
$pointerValue = '';
72+
break;
73+
}
74+
6775
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tableName);
6876
$queryBuilder->getRestrictions()
6977
->removeAll()
@@ -85,7 +93,7 @@ public function initializeDataStructureIdentifier(BeforeFlexFormDataStructureIde
8593
throw new FlexFormInvalidPointerFieldException(
8694
'The data structure for field "' . $fieldName . '" in table "' . $tableName . '" has to be looked up'
8795
. ' in field "' . $pointerFieldName . '". That field had no valid value, so a lookup in parent record'
88-
. ' with uid "' . $row[$parentFieldName] . '" was done. However, this row does not exist or was deleted.',
96+
. ' with uid "' . $parentUid . '" was done. However, this row does not exist or was deleted.',
8997
1463833794
9098
);
9199
}
@@ -131,7 +139,14 @@ public function setDataStructure(BeforeFlexFormDataStructureParsedEvent $event):
131139
$identifier = $event->getIdentifier();
132140
if (($identifier['type'] ?? '') === 'combinedMappingIdentifier') {
133141
$dataStructure = [
134-
'sheets' => [],
142+
'sheets' => [
143+
'sDEF' => [
144+
'ROOT' => [
145+
'el' => [
146+
],
147+
],
148+
],
149+
],
135150
];
136151

137152
if ($identifier['cobinedIdentifier'] !== '') {

0 commit comments

Comments
 (0)