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

Breadcrumb

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

function PropertyNormalizer::extractAttributes

Overrides AbstractObjectNormalizer::extractAttributes

File

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

Class

PropertyNormalizer
Converts between objects and arrays by mapping properties.

Namespace

Symfony\Component\Serializer\Normalizer

Code

protected function extractAttributes(object $object, ?string $format = null, array $context = []) : array {
    $reflectionObject = new \ReflectionObject($object);
    $attributes = [];
    do {
        foreach ($reflectionObject->getProperties() as $property) {
            if (!$this->isAllowedAttribute($reflectionObject->getName(), $property->name, $format, $context)) {
                continue;
            }
            $attributes[] = $property->name;
        }
    } while ($reflectionObject = $reflectionObject->getParentClass());
    return array_unique($attributes);
}
RSS feed
Powered by Drupal