You are here

public function QueryProvider::getQuery in GraphQL 8.3

Returns a query string given the query parameters.

Can be used to load a query string from arbitrary query parameters e.g. when using persisted queries (loading queries by their hash or version and id).

Parameters

string $id: The query id.

\GraphQL\Server\OperationParams $operation: The operation parameters.

Return value

string|null The query string or NULL if it couldn't be determined.

Overrides QueryProviderInterface::getQuery

File

src/GraphQL/QueryProvider/QueryProvider.php, line 26

Class

QueryProvider

Namespace

Drupal\graphql\GraphQL\QueryProvider

Code

public function getQuery($id, OperationParams $operation) {
  foreach ($this
    ->getSortedProviders() as $provider) {
    if ($query = $provider
      ->getQuery($id, $operation)) {
      return $query;
    }
  }
  return NULL;
}