protected function encodeObjectReferences(array &$array)
{
foreach ($array as &$value) {
if (is_array($value)) {
$this->encodeObjectReferences($value);
}
if (!is_object($value) || is_object($value) && $value instanceof DependencyProxy) {
continue;
}
$propertyClassName = TypeHandling::getTypeForValue($value);
if ($value instanceof \SplObjectStorage) {
throw new \RuntimeException('SplObjectStorage in array properties is not supported', 1375196580);
} elseif ($value instanceof \Doctrine\Common\Collections\Collection) {
throw new \RuntimeException('Collection in array properties is not supported', 1375196581);
} elseif ($value instanceof \ArrayObject) {
throw new \RuntimeException('ArrayObject in array properties is not supported', 1375196582);
} elseif ($this->persistenceManager->isNewObject($value) === false && ($this->reflectionService->isClassAnnotatedWith($propertyClassName, Flow\Entity::class) || $this->reflectionService->isClassAnnotatedWith($propertyClassName, Flow\ValueObject::class) || $this->reflectionService->isClassAnnotatedWith($propertyClassName, \Doctrine\ORM\Mapping\Entity::class))) {
$value = ['__flow_object_type' => $propertyClassName, '__identifier' => $this->persistenceManager->getIdentifierByObject($value)];
}
}
}