Skip to content

Commit

Permalink
[BUGFIX] Replace properties correctly in Extbase Persistence Class ov…
Browse files Browse the repository at this point in the history
…errides

Due to a bug, the class properties did not override
properly using alternative names as the TYPO3-internal
"mergeRecursiveWithOverrule" was used in the wrong order.

This patch now uses "array_replace_recursive" and adds the
child properties at the very end.

Resolves: #87566
Releases: main, 11.5, 10.4
Change-Id: I91799cfb6c2effb8440bd099502ae801c9a69d15
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73040
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
bmack committed Jan 22, 2022
1 parent 2394359 commit ea5e2de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Expand Up @@ -111,7 +111,8 @@ private function inheritPropertiesFromParentClasses(array $classes): array
continue;
}

ArrayUtility::mergeRecursiveWithOverrule($classes[$className]['properties'], $properties, true, false);
// Merge new properties over existing ones.
$classes[$className]['properties'] = array_replace_recursive($properties, $classes[$className]['properties'] ?? []);
}
}

Expand Down
Expand Up @@ -82,9 +82,7 @@ public function inheritPropertiesFromParentClasses(): void
B::class => [
'properties' => [
'propertiesFromA' => [
// todo: this is flawed, we'd actually expect field_name_z here
// todo: see https://forge.typo3.org/issues/87566
'fieldName' => 'field_name_a',
'fieldName' => 'field_name_z',
],
'propertiesFromB' => [
'fieldName' => 'field_name_b',
Expand All @@ -93,15 +91,15 @@ public function inheritPropertiesFromParentClasses(): void
],
C::class => [
'properties' => [
'columnNameC' => [
'fieldName' => 'field_name_c',
],
'propertiesFromA' => [
'fieldName' => 'field_name_a',
'fieldName' => 'field_name_z',
],
'propertiesFromB' => [
'fieldName' => 'field_name_b',
],
'columnNameC' => [
'fieldName' => 'field_name_c',
],
],
],
],
Expand Down

0 comments on commit ea5e2de

Please sign in to comment.