Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractObjectNormalizer.php

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\Normalizer

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal