Bug #87566
closedColumn configuration can't be overridden by child object
100%
Description
This one is a bit tricky and best explained by an example.
We have the following configuration:
config.tx_extbase.persistence.classes {
TYPO3\CMS\Extbase\Domain\Model\BackendUser {
mapping {
columns {
username.mapOnProperty = userName
}
}
}
}
and the following one:
config.tx_extbase.persistence.classes {
TYPO3\CMS\Beuser\Domain\Model\BackendUser {
mapping {
columns {
username.mapOnProperty = overridden
}
}
}
}
It's important to recognize the following heritage:
TYPO3\CMS\Beuser\Domain\Model\BackendUser extends TYPO3\CMS\Extbase\Domain\Model\BackendUser
The issue:
When a datamap is created, the configuration of the child object TYPO3\CMS\Beuser\Domain\Model\BackendUser gets merged with the one of TYPO3\CMS\Extbase\Domain\Model\BackendUser but in a way that the configuration of the child object does not override the one of the parent.
The property of TYPO3\CMS\Beuser\Domain\Model\BackendUser being mapped on field username should be overridden, instead it's the one of the parent (userName).
However, adding new columns works just fine.
Updated by Mathias Brodala over 3 years ago
- Due date set to 2019-02-04
- Start date changed from 2019-01-28 to 2019-02-04
- Follows Task #87623: Replace config.persistence.classes typoscript added
Updated by Claus Harup over 3 years ago
This is working for me in TYPO3 v. 10:
\typo3\sysext\extbase\Classes\Persistence\ClassesConfigurationFactory.php
....
foreach ($relevantParentClasses as $currentClassName) {
if (null === $properties = $classes[$currentClassName]['properties'] ?? null) {
continue;
}
//ArrayUtility::mergeRecursiveWithOverrule($classes[$className]['properties'], $properties, true, false);
/*
* Outcommenting the line above and adding the lines below
* to override the naming of properties when extending models
*/
ArrayUtility::mergeRecursiveWithOverrule($properties, $classes[$className]['properties'], true, false);
$classes[$className]['properties'] = $properties;
}
....
.... this way properties are assigned to the child object's databasefield if the propertyname colides with any parent class.
Updated by Gerrit Code Review almost 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73040
Updated by Gerrit Code Review almost 3 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73040
Updated by Gerrit Code Review almost 3 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73040
Updated by Gerrit Code Review almost 3 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73040
Updated by Gerrit Code Review almost 3 years ago
Patch set 1 for branch 11.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/+/73086
Updated by Gerrit Code Review almost 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73087
Updated by Gerrit Code Review almost 3 years ago
Patch set 2 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73087
Updated by Benni Mack almost 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ea5e2def06ee9f27c8909a3ac77e1293ebb8b16e.