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

Breadcrumb

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

function PropertyNormalizer::getReflectionProperty

Throws

\ReflectionException

3 calls to PropertyNormalizer::getReflectionProperty()
PropertyNormalizer::getAttributeValue in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Gets the attribute value.
PropertyNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Is this attribute allowed?
PropertyNormalizer::setAttributeValue in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php

File

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

Class

PropertyNormalizer
Converts between objects and arrays by mapping properties.

Namespace

Symfony\Component\Serializer\Normalizer

Code

private function getReflectionProperty(string|object $classOrObject, string $attribute) : \ReflectionProperty {
    $reflectionClass = new \ReflectionClass($classOrObject);
    while (true) {
        try {
            return $reflectionClass->getProperty($attribute);
        } catch (\ReflectionException $e) {
            if (!($reflectionClass = $reflectionClass->getParentClass())) {
                throw $e;
            }
        }
    }
}
RSS feed
Powered by Drupal