ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer::getDefinition PHP Method

getDefinition() private method

private getDefinition ( ArrayObject $definitions, boolean $collection, boolean $parameter, ResourceMetadata $resourceMetadata, string $resourceClass, string $operationName ) : string
$definitions ArrayObject
$collection boolean
$parameter boolean
$resourceMetadata ApiPlatform\Core\Metadata\Resource\ResourceMetadata
$resourceClass string
$operationName string
return string
    private function getDefinition(\ArrayObject $definitions, bool $collection, bool $parameter, ResourceMetadata $resourceMetadata, string $resourceClass, string $operationName) : string
    {
        $contextKey = $parameter ? 'denormalization_context' : 'normalization_context';
        $serializerContext = $collection ? $resourceMetadata->getCollectionOperationAttribute($operationName, $contextKey, null, true) : $resourceMetadata->getItemOperationAttribute($operationName, $contextKey, null, true);
        if (isset($serializerContext['groups'])) {
            $definitionKey = sprintf('%s_%s', $resourceMetadata->getShortName(), md5(serialize($serializerContext['groups'])));
        } else {
            $definitionKey = $resourceMetadata->getShortName();
        }
        $definitions[$definitionKey] = $this->getDefinitionSchema($resourceClass, $resourceMetadata, $serializerContext);
        return $definitionKey;
    }