protected function AbstractNormalizer::getAllowedAttributes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Normalizer/AbstractNormalizer.php \Symfony\Component\Serializer\Normalizer\AbstractNormalizer::getAllowedAttributes()
Gets attributes to normalize using groups.
Parameters
string|object $classOrObject:
array $context:
bool $attributesAsString If false, return an array of {@link AttributeMetadataInterface}:
Return value
string[]|AttributeMetadataInterface[]|bool
6 calls to AbstractNormalizer::getAllowedAttributes()
- GetSetMethodNormalizer::denormalize in vendor/
symfony/ serializer/ Normalizer/ GetSetMethodNormalizer.php - GetSetMethodNormalizer::normalize in vendor/
symfony/ serializer/ Normalizer/ GetSetMethodNormalizer.php - ObjectNormalizer::denormalize in vendor/
symfony/ serializer/ Normalizer/ ObjectNormalizer.php - Denormalizes data back into an object of the given class.
- ObjectNormalizer::normalize in vendor/
symfony/ serializer/ Normalizer/ ObjectNormalizer.php - PropertyNormalizer::denormalize in vendor/
symfony/ serializer/ Normalizer/ PropertyNormalizer.php
File
- vendor/
symfony/ serializer/ Normalizer/ AbstractNormalizer.php, line 249
Class
- AbstractNormalizer
- Normalizer implementation.
Namespace
Symfony\Component\Serializer\NormalizerCode
protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) {
if (!$this->classMetadataFactory || !isset($context['groups']) || !is_array($context['groups'])) {
return false;
}
$allowedAttributes = array();
foreach ($this->classMetadataFactory
->getMetadataFor($classOrObject)
->getAttributesMetadata() as $attributeMetadata) {
if (count(array_intersect($attributeMetadata
->getGroups(), $context['groups']))) {
$allowedAttributes[] = $attributesAsString ? $attributeMetadata
->getName() : $attributeMetadata;
}
}
return array_unique($allowedAttributes);
}