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\NormalizerCode
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);
}