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

Breadcrumb

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

function PropertyNormalizer::setAttributeValue

Overrides AbstractObjectNormalizer::setAttributeValue

File

vendor/symfony/serializer/Normalizer/PropertyNormalizer.php, line 172

Class

PropertyNormalizer
Converts between objects and arrays by mapping properties.

Namespace

Symfony\Component\Serializer\Normalizer

Code

protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []) : void {
    try {
        $reflectionProperty = $this->getReflectionProperty($object, $attribute);
    } catch (\ReflectionException) {
        return;
    }
    if ($reflectionProperty->isStatic()) {
        return;
    }
    $reflectionProperty->setValue($object, $value);
}
RSS feed
Powered by Drupal