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

Breadcrumb

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

function ObjectNormalizer::getAttributeValue

Overrides AbstractObjectNormalizer::getAttributeValue

File

vendor/symfony/serializer/Normalizer/ObjectNormalizer.php, line 134

Class

ObjectNormalizer
Converts between objects and arrays using the PropertyAccess component.

Namespace

Symfony\Component\Serializer\Normalizer

Code

protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []) : mixed {
    $mapping = $this->classDiscriminatorResolver?->getMappingForMappedObject($object);
    return $attribute === $mapping?->getTypeProperty() ? $mapping : $this->propertyAccessor
        ->getValue($object, $attribute);
}
RSS feed
Powered by Drupal