Neos\Flow\Persistence\Doctrine\DataTypes\JsonArrayType::encodeObjectReferences PHP Метод

encodeObjectReferences() защищенный Метод

Traverses the $array and replaces known persisted objects with a tuple of type and identifier.
protected encodeObjectReferences ( array &$array ) : void
$array array
Результат void
    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 \DateTimeInterface) {
                $value = ['date' => $value->format('Y-m-d H:i:s.u'), 'timezone' => $value->format('e'), 'dateFormat' => 'Y-m-d H:i:s.u'];
            } elseif ($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)];
            }
        }
    }