Bug #62056
closedExtbase disregards discriminator when retrieving existing Value Object UIDs
0%
Description
When using STI with Value Objects only the actual properties of the Value Object are checked and searched for in the database in order to find any existing UID. The TCA type column which defines the object type is disregarded at this point. The result is a wrong relation and wrong object type.
Consider following example:
Parent extends AbstractValueObject { protected $someValue = ''; } Child1 extends Parent {} Child2 extends Parent {} SomeObject { // many to one relation to Parent /** @var Parent */ protected $object; }
Given the TCA configuration is correct and you have already a Child1 persisted with the default value, the following code will fail:
$someObject->setObject(new Child2());
After fetching $someObject from the database again, it will contain an instance of Child1, and not Child2.
As a workaround, the Value Object can be extended with a property containing the FQCN. In this case it would work as expected.
Updated by Alexander Opitz almost 7 years ago
- Status changed from New to Needs Feedback
Hi,
does the problem still exists within newer versions of TYPO3 CMS (8.6.10)?
Updated by Riccardo De Contardi over 6 years ago
- Status changed from Needs Feedback to Closed
No feedback since the last 90 days => closing this issue.
If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or open a new issue with a reference to this one.
Thank you and best regards