You are here

SchemaPluginManager.php in GraphQL 8.4

Same filename and directory in other branches
  1. 8.3 src/Plugin/SchemaPluginManager.php

File

src/Plugin/SchemaPluginManager.php
View source
<?php

namespace Drupal\graphql\Plugin;

use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
 * Manager that collects and exposes GraphQL schema plugins.
 *
 * @package Drupal\graphql\Plugin
 *
 * @codeCoverageIgnore
 */
class SchemaPluginManager extends DefaultPluginManager {

  /**
   * SchemaPluginManager constructor.
   *
   * @param bool|string $pluginSubdirectory
   *   The plugin's subdirectory.
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
   *   The module handler.
   * @param \Drupal\Core\Cache\CacheBackendInterface $cacheBackend
   *   The cache backend.
   * @param string|null $pluginInterface
   *   The interface each plugin should implement.
   * @param string $pluginAnnotationName
   *   The name of the annotation that contains the plugin definition.
   * @param array $config
   *   The configuration service parameter.
   */
  public function __construct($pluginSubdirectory, \Traversable $namespaces, ModuleHandlerInterface $moduleHandler, CacheBackendInterface $cacheBackend, $pluginInterface, $pluginAnnotationName, array $config) {
    parent::__construct($pluginSubdirectory, $namespaces, $moduleHandler, $pluginInterface, $pluginAnnotationName);
    $this
      ->alterInfo('graphql_schema');
    $this
      ->useCaches(empty($config['development']));
    $this
      ->setCacheBackend($cacheBackend, 'graphql_schema', [
      'graphql_schema',
    ]);
  }

}

Classes

Namesort descending Description
SchemaPluginManager Manager that collects and exposes GraphQL schema plugins.