function AbstractObjectNormalizer::getNestedAttributes
Returns all attributes with a SerializedPath attribute and the respective path.
1 call to AbstractObjectNormalizer::getNestedAttributes()
- AbstractObjectNormalizer::denormalize in vendor/
symfony/ serializer/ Normalizer/ AbstractObjectNormalizer.php - Denormalizes data back into an object of the given class.
File
-
vendor/
symfony/ serializer/ Normalizer/ AbstractObjectNormalizer.php, line 1111
Class
- AbstractObjectNormalizer
- Base class for a normalizer dealing with objects.
Namespace
Symfony\Component\Serializer\NormalizerCode
private function getNestedAttributes(string $class) : array {
if (!$this->classMetadataFactory?->hasMetadataFor($class)) {
return [];
}
$properties = [];
$serializedPaths = [];
$classMetadata = $this->classMetadataFactory
->getMetadataFor($class);
foreach ($classMetadata->getAttributesMetadata() as $name => $metadata) {
if (!($serializedPath = $metadata->getSerializedPath())) {
continue;
}
$pathIdentifier = implode(',', $serializedPath->getElements());
if (isset($serializedPaths[$pathIdentifier])) {
throw new LogicException(\sprintf('Duplicate serialized path: "%s" used for properties "%s" and "%s".', $pathIdentifier, $serializedPaths[$pathIdentifier], $name));
}
$serializedPaths[$pathIdentifier] = $name;
$properties[$name] = $serializedPath;
}
return $properties;
}