Example #1
0
 /**
  * Remove any unreferenced non aggregate root entity
  *
  * @param object $object
  * @param string $propertyName
  * @param array $propertyMetaData
  * @return void
  */
 protected function removeDeletedReference($object, $propertyName, $propertyMetaData)
 {
     $previousValue = $this->persistenceSession->getCleanStateOfProperty($object, $propertyName);
     if ($previousValue !== NULL && is_array($previousValue) && isset($previousValue['value']['identifier']) && $this->reflectionService->getClassSchema($propertyMetaData['type'])->getModelType() === \TYPO3\FLOW3\Reflection\ClassSchema::MODELTYPE_ENTITY && $this->reflectionService->getClassSchema($propertyMetaData['type'])->isAggregateRoot() === FALSE) {
         $object = $this->persistenceSession->getObjectByIdentifier($previousValue['value']['identifier']);
         if (!$this->visitedDuringPersistence->contains($object)) {
             $this->removeEntity($object);
         }
     }
 }