Bug #62056

Extbase disregards discriminator when retrieving existing Value Object UIDs

Added by Philipp Maier about 7 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-10-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

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.

#1

Updated by Alexander Opitz over 3 years ago

  • Status changed from New to Needs Feedback

Hi,

does the problem still exists within newer versions of TYPO3 CMS (8.6.10)?

#2

Updated by Riccardo De Contardi over 3 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

Also available in: Atom PDF