ApiPlatform\Core\Serializer\AbstractItemNormalizer::getAllowedAttributes PHP Method

getAllowedAttributes() protected method

protected getAllowedAttributes ( $classOrObject, array $context, $attributesAsString = false )
$context array
    protected function getAllowedAttributes($classOrObject, array $context, $attributesAsString = false)
    {
        $options = $this->getFactoryOptions($context);
        $propertyNames = $this->propertyNameCollectionFactory->create($context['resource_class'], $options);
        $allowedAttributes = [];
        foreach ($propertyNames as $propertyName) {
            $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $propertyName, $options);
            if (isset($context['api_normalize']) && $propertyMetadata->isReadable() || isset($context['api_denormalize']) && $propertyMetadata->isWritable()) {
                $allowedAttributes[] = $propertyName;
            }
        }
        return $allowedAttributes;
    }