protected function removeDeletedArrayEntries(array $array = null, array $previousArray)
{
foreach ($previousArray as $item) {
if ($item['type'] === 'array') {
$this->removeDeletedArrayEntries($array[$item['index']], $item['value']);
} elseif ($this->getTypeName($item['type']) === 'object' && !($item['type'] === 'DateTime' || $item['type'] === 'SplObjectStorage')) {
if (!$this->persistenceSession->hasIdentifier($item['value']['identifier'])) {
// ingore this identifier, assume it was blocked by security query rewriting
continue;
}
$object = $this->persistenceSession->getObjectByIdentifier($item['value']['identifier']);
if ($array === null || !$this->arrayContainsObject($array, $object, $item['value']['identifier'])) {
if ($this->reflectionService->getClassSchema($item['type'])->getModelType() === ClassSchema::MODELTYPE_ENTITY && $this->reflectionService->getClassSchema($item['type'])->isAggregateRoot() === false) {
$this->removeEntity($this->persistenceSession->getObjectByIdentifier($item['value']['identifier']));
} elseif ($this->reflectionService->getClassSchema($item['type'])->getModelType() === ClassSchema::MODELTYPE_VALUEOBJECT) {
$this->removeValueObject($this->persistenceSession->getObjectByIdentifier($item['value']['identifier']));
}
}
}
}
}