You are here

protected function Server::getPersistedQueryLoader in GraphQL 8.4

Returns a callable for loading persisted queries.

Return value

callable The persisted query loader.

1 call to Server::getPersistedQueryLoader()
Server::configuration in src/Entity/Server.php

File

src/Entity/Server.php, line 450

Class

Server
The main GraphQL configuration and request entry point.

Namespace

Drupal\graphql\Entity

Code

protected function getPersistedQueryLoader() {
  return function ($id, OperationParams $params) {
    $sortedPersistedQueryInstances = $this
      ->getSortedPersistedQueryInstances();
    if (!empty($sortedPersistedQueryInstances)) {
      foreach ($sortedPersistedQueryInstances as $persistedQueryInstance) {
        $query = $persistedQueryInstance
          ->getQuery($id, $params);
        if (!is_null($query)) {
          return $query;
        }
      }
    }
  };
}