You are here

protected function QueryProcessor::loadPersistedQuery in GraphQL 8.3

Parameters

\GraphQL\Server\ServerConfig $config:

\GraphQL\Server\OperationParams $params:

Return value

mixed

Throws

\GraphQL\Server\RequestError

1 call to QueryProcessor::loadPersistedQuery()
QueryProcessor::executeOperation in src/GraphQL/Execution/QueryProcessor.php

File

src/GraphQL/Execution/QueryProcessor.php, line 434

Class

QueryProcessor

Namespace

Drupal\graphql\GraphQL\Execution

Code

protected function loadPersistedQuery(ServerConfig $config, OperationParams $params) {
  if (!($loader = $config
    ->getPersistentQueryLoader())) {
    throw new RequestError('Persisted queries are not supported by this server.');
  }
  $source = $loader($params->queryId, $params);
  if (!is_string($source) && !$source instanceof DocumentNode) {
    throw new RequestError(sprintf('The persisted query loader must return query string or instance of %s but got: %s.', DocumentNode::class, Utils::printSafe($source)));
  }
  return $source;
}