src/Bridge/Doctrine/Orm/Extension/EagerLoadingExtension.php
private function getNormalizationContext(string $resourceClass, string $contextType, array $options): array
    {
        if (null !== $this->requestStack && null !== $this->serializerContextBuilder && null !== $request = $this->requestStack->getCurrentRequest()) {
            return $this->serializerContextBuilder->createFromRequest($request, 'normalization_context' === $contextType);
        }

        $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
        if (isset($options['collection_operation_name'])) {
            $context = $resourceMetadata->getCollectionOperationAttribute($options['collection_operation_name'], $contextType, null, true);
        } elseif (isset($options['item_operation_name'])) {
            $context = $resourceMetadata->getItemOperationAttribute($options['item_operation_name'], $contextType, null, true);
        } else {
            $context = $resourceMetadata->getAttribute($contextType);
        }

        return $context ?? [];
    }
private function getNormalizationContext(string $resourceClass, string $contextType, array $options): array
    {
        if (null !== $this->requestStack && null !== $this->serializerContextBuilder && null !== $request = $this->requestStack->getCurrentRequest()) {
            return $this->serializerContextBuilder->createFromRequest($request, 'normalization_context' === $contextType);
        }

        $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
        if (isset($options['collection_operation_name'])) {
            $context = $resourceMetadata->getCollectionOperationAttribute($options['collection_operation_name'], $contextType, null, true);
        } elseif (isset($options['item_operation_name'])) {
            $context = $resourceMetadata->getItemOperationAttribute($options['item_operation_name'], $contextType, null, true);
        } else {
            $context = $resourceMetadata->getAttribute($contextType);
        }

        return $context ?? [];
    }
private function getNormalizationContext ( string $ resourceClass , string $ contextType , array $ options ) : array { if ( null !== $ this -> requestStack && null !== $ this -> serializerContextBuilder && null !== $ request = $ this -> requestStack -> getCurrentRequest ( ) ) { return $ this -> serializerContextBuilder -> createFromRequest ( $ request , 'normalization_context' === $ contextType ) ; } $ resourceMetadata = $ this -> resourceMetadataFactory -> create ( $ resourceClass ) ; if ( isset ( $ options [ 'collection_operation_name' ] ) ) { $ context = $ resourceMetadata -> getCollectionOperationAttribute ( $ options [ 'collection_operation_name' ] , $ contextType , null , true ) ; } elseif ( isset ( $ options [ 'item_operation_name' ] ) ) { $ context = $ resourceMetadata -> getItemOperationAttribute ( $ options [ 'item_operation_name' ] , $ contextType , null , true ) ; } else { $ context = $ resourceMetadata -> getAttribute ( $ contextType ) ; } return $ context ?? [ ] ; }
Gets the serializer context.

@param string $contextType normalization_context or denormalization_context
@param array  $options     represents the operation name so that groups are the one of the specific operation
Gets the serializer context .