class TypePluginManagerAggregator in GraphQL 8.3
Hierarchy
- class \Drupal\graphql\Plugin\TypePluginManagerAggregator implements \Drupal\graphql\Plugin\IteratorAggregate
Expanded class hierarchy of TypePluginManagerAggregator
2 files declare their use of TypePluginManagerAggregator
- PluggableSchemaDeriver.php in src/
Plugin/ Deriver/ PluggableSchemaDeriver.php - SchemaPluginBase.php in src/
Plugin/ GraphQL/ Schemas/ SchemaPluginBase.php
1 string reference to 'TypePluginManagerAggregator'
1 service uses TypePluginManagerAggregator
File
- src/
Plugin/ TypePluginManagerAggregator.php, line 5
Namespace
Drupal\graphql\PluginView source
class TypePluginManagerAggregator implements \IteratorAggregate {
/**
* List of registered plugin managers.
*
* @var \Drupal\graphql\Plugin\TypePluginManagerInterface[]
*/
protected $pluginManagers = [];
/**
* Registers a plugin manager.
*
* @param \Drupal\graphql\Plugin\TypePluginManagerInterface $pluginManager
* The plugin manager to register.
* @param $id
* The id of the service.
*/
public function addTypeManager(TypePluginManagerInterface $pluginManager, $id) {
$pieces = explode('.', $id);
$key = end($pieces);
$this->pluginManagers[$key] = $pluginManager;
}
/**
* Retrieves a plugin manager by its type.
*
* @param string $type
* The plugin type.
*
* @return \Drupal\graphql\Plugin\TypePluginManagerInterface
* The plugin managers for the given plugin type.
*/
public function getTypeManager($type) {
if (isset($this->pluginManagers[$type])) {
return $this->pluginManagers[$type];
}
throw new \LogicException(sprintf("Couldn't find a plugin manager for type '%s'.", $type));
}
/**
* {@inheritdoc}
*/
public function getIterator() {
return new \ArrayIterator($this->pluginManagers);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TypePluginManagerAggregator:: |
protected | property | List of registered plugin managers. | |
TypePluginManagerAggregator:: |
public | function | Registers a plugin manager. | |
TypePluginManagerAggregator:: |
public | function | ||
TypePluginManagerAggregator:: |
public | function | Retrieves a plugin manager by its type. |