protected function removeDeletedSplObjectStorageEntries(\SplObjectStorage $splObjectStorage = null, array $previousObjectStorage)
{
// remove objects detached since reconstitution
foreach ($previousObjectStorage as $item) {
if ($splObjectStorage instanceof LazySplObjectStorage && !$this->persistenceSession->hasIdentifier($item['value']['identifier'])) {
// ingore this identifier, assume it was blocked by security query rewriting upon activation
continue;
}
$object = $this->persistenceSession->getObjectByIdentifier($item['value']['identifier']);
if ($splObjectStorage === null || !$splObjectStorage->contains($object)) {
if ($this->reflectionService->getClassSchema($object)->getModelType() === ClassSchema::MODELTYPE_ENTITY && $this->reflectionService->getClassSchema($object)->isAggregateRoot() === false) {
$this->removeEntity($object);
} elseif ($this->reflectionService->getClassSchema($object)->getModelType() === ClassSchema::MODELTYPE_VALUEOBJECT) {
$this->removeValueObject($object);
}
}
}
}