CommonGateway\CoreBundle\Service\RequestService

Handles incoming request from endpoints or controllers that relate to the gateways object structure (eav).

Methods

Name Description
__construct The constructor sets al needed variables.
checkEmbedded If embedded should be shown or not.
createResponse Creating the response object.
getId Get the ID from given parameters.
getSchema Get the schema from given parameters returns false if no schema could be established.
getScopes Get a scopes array for the current user (or of the anonymus if no user s logged in).
proxyHandler
proxyRequestHandler Determines the proxy source from configuration, then use proxy handler to proxy the request.
realRequestQueryAll A function to replace Request->query->all() because Request->query->all() will replace some characters with an underscore.
requestHandler Handles incomming requests and is responsible for generating a response.
serializeData Determines the right content type and serializes the data accordingly.
shouldWeUnsetEmbedded Handle the Application Endpoint Configuration for embedded. If embedded should be shown or not.

RequestService::__construct

Description

public __construct (\EntityManagerInterface $entityManager, \GatewayResourceService $resourceService, \MappingService $mappingService, \ValidationService $validationService, \CacheService $cacheService, \ResponseService $responseService, \ObjectEntityService $objectEntityService, \LogService $logService, \CallService $callService, \Security $security, \EventDispatcherInterface $eventDispatcher, \SerializerInterface $serializer, \SessionInterface $session, \LoggerInterface $requestLogger, \DownloadService $downloadService)

The constructor sets al needed variables.

Parameters

  • (\EntityManagerInterface) $entityManager
  • (\GatewayResourceService) $resourceService
  • (\MappingService) $mappingService
  • (\ValidationService) $validationService
  • (\CacheService) $cacheService
  • (\ResponseService) $responseService
  • (\ObjectEntityService) $objectEntityService
  • (\LogService) $logService
  • (\CallService) $callService
  • (\Security) $security
  • (\EventDispatcherInterface) $eventDispatcher
  • (\SerializerInterface) $serializer
  • (\SessionInterface) $session
  • (\LoggerInterface) $requestLogger
  • (\DownloadService) $downloadService

Return Values

void


RequestService::checkEmbedded

Description

public checkEmbedded (object|array $result)

If embedded should be shown or not.

Parameters

  • (object|array) $result : fetched result

Return Values

array|null


RequestService::createResponse

Description

public createResponse ( $data)

Creating the response object.

Parameters

  • () $data

Return Values

\Response


RequestService::getId

Description

public getId (void)

Get the ID from given parameters.

Parameters

This function has no parameters.

Return Values

string|false


RequestService::getSchema

Description

public getSchema (array $parameters)

Get the schema from given parameters returns false if no schema could be established.

Parameters

  • (array) $parameters

Return Values

\Entity|false


RequestService::getScopes

Description

public getScopes (void)

Get a scopes array for the current user (or of the anonymus if no user s logged in).

Parameters

This function has no parameters.

Return Values

array


RequestService::proxyHandler

Description

 proxyHandler (void)

Parameters

This function has no parameters.

Return Values

void


RequestService::proxyRequestHandler

Description

public proxyRequestHandler (array $parameters, array $configuration)

Determines the proxy source from configuration, then use proxy handler to proxy the request.

Parameters

  • (array) $parameters : The parameters of the request.
  • (array) $configuration : The configuration of the action.

Return Values

array

The result of the proxy.


RequestService::realRequestQueryAll

Description

public realRequestQueryAll (string|null $queryString)

A function to replace Request->query->all() because Request->query->all() will replace some characters with an underscore.

This function will not.

Parameters

  • (string|null) $queryString : A queryString from a request if we want to give it to this function instead of using global var $_SERVER.

Return Values

array

An array with all query parameters.


RequestService::requestHandler

Description

public requestHandler (array $data, array $configuration)

Handles incomming requests and is responsible for generating a response.

Parameters

  • (array) $data : The data from the call
  • (array) $configuration : The configuration from the call

Return Values

\Response

The modified data

Throws Exceptions

\Exception


RequestService::serializeData

Description

public serializeData (array $data, mixed $contentType)

Determines the right content type and serializes the data accordingly.

Parameters

  • (array) $data : The data to serialize.
  • (mixed) $contentType : The content type to determine.

Return Values

string

The serialized data.


RequestService::shouldWeUnsetEmbedded

Description

public shouldWeUnsetEmbedded (object|array $result, array $embeddedConfig)

Handle the Application Endpoint Configuration for embedded. If embedded should be shown or not.

Configuration Example: ['global']['out']['embedded']['unset'] = true
Configuration Example 2: ['global']['out']['embedded']['unset']['except'] = ['application/json+ld', 'application/ld+json'].

Parameters

  • (object|array) $result : fetched result
  • (array) $embeddedConfig : Application configuration ['out']['embedded']

Return Values

array|null

The updated result.