ApiPlatform\Core\Bridge\NelmioApiDoc\Parser\ApiPlatformParser::getGroupsContext PHP Method

getGroupsContext() private method

private getGroupsContext ( ResourceMetadata $resourceMetadata, string $operationName, boolean $isNormalization )
$resourceMetadata ApiPlatform\Core\Metadata\Resource\ResourceMetadata
$operationName string
$isNormalization boolean
    private function getGroupsContext(ResourceMetadata $resourceMetadata, string $operationName, bool $isNormalization)
    {
        $groupsContext = $isNormalization ? 'normalization_context' : 'denormalization_context';
        $itemOperationAttribute = $resourceMetadata->getItemOperationAttribute($operationName, $groupsContext, ['groups' => []], true)['groups'];
        $collectionOperationAttribute = $resourceMetadata->getCollectionOperationAttribute($operationName, $groupsContext, ['groups' => []], true)['groups'];
        return [$groupsContext => ['groups' => array_merge(isset($itemOperationAttribute) ? $itemOperationAttribute : [], isset($collectionOperationAttribute) ? $collectionOperationAttribute : [])]];
    }