public function Server::configuration in GraphQL 8.4
Throws
\Drupal\Component\Plugin\Exception\PluginException
Overrides ServerInterface::configuration
1 call to Server::configuration()
- Server::executeOperation in src/
Entity/ Server.php - Execute an operation on this server.
File
- src/
Entity/ Server.php, line 206
Class
- Server
- The main GraphQL configuration and request entry point.
Namespace
Drupal\graphql\EntityCode
public function configuration() {
$params = \Drupal::getContainer()
->getParameter('graphql.config');
/** @var \Drupal\graphql\Plugin\SchemaPluginManager $manager */
$manager = \Drupal::service('plugin.manager.graphql.schema');
$schema = $this
->get('schema');
/** @var \Drupal\graphql\Plugin\SchemaPluginInterface $plugin */
$plugin = $manager
->createInstance($schema);
if ($plugin instanceof ConfigurableInterface && ($config = $this
->get('schema_configuration'))) {
$plugin
->setConfiguration($config[$schema] ?? []);
}
// Create the server config.
$registry = $plugin
->getResolverRegistry();
$server = ServerConfig::create();
$server
->setDebugFlag($this
->get('debug_flag'));
$server
->setQueryBatching(!!$this
->get('batching'));
$server
->setValidationRules($this
->getValidationRules());
$server
->setPersistentQueryLoader($this
->getPersistedQueryLoader());
$server
->setContext($this
->getContext($plugin, $params));
$server
->setFieldResolver($this
->getFieldResolver($registry));
$server
->setSchema($plugin
->getSchema($registry));
$server
->setPromiseAdapter(new SyncPromiseAdapter());
return $server;
}