You are here

public function Server::addPersistedQueryInstance in GraphQL 8.4

Adds a Persisted Query plugin instance to the persisted queries set.

Parameters

\Drupal\graphql\Plugin\PersistedQueryPluginInterface $queryPlugin:

Overrides ServerInterface::addPersistedQueryInstance

File

src/Entity/Server.php, line 377

Class

Server
The main GraphQL configuration and request entry point.

Namespace

Drupal\graphql\Entity

Code

public function addPersistedQueryInstance(PersistedQueryPluginInterface $queryPlugin) : void {

  // Make sure the persistedQueryInstances are loaded before trying to add a
  // plugin to them.
  if (is_null($this->persisted_query_instances)) {
    $this
      ->getPersistedQueryInstances();
  }
  $this->persisted_query_instances[$queryPlugin
    ->getPluginId()] = $queryPlugin;
}