public function PluggableSchemaDeriver::getDerivativeDefinitions in GraphQL 8.3
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ Deriver/ PluggableSchemaDeriver.php, line 98
Class
Namespace
Drupal\graphql\Plugin\DeriverCode
public function getDerivativeDefinitions($basePluginDefinition) {
// Construct the optimized data representation for building the schema.
$typeMap = $this
->buildTypeMap(iterator_to_array($this->typeManagers));
$typeReferenceMap = $this
->buildTypeReferenceMap($typeMap);
$typeAssocationMap = $this
->buildTypeAssociationMap($typeMap);
$fieldAssocationMap = $this
->buildFieldAssociationMap($this->fieldManager, $typeMap);
$fieldMap = $this
->buildFieldMap($this->fieldManager, $fieldAssocationMap);
$mutationMap = $this
->buildMutationMap($this->mutationManager);
$subscriptionMap = $this
->buildSubscriptionMap($this->subscriptionManager);
$managers = array_merge([
$this->fieldManager,
$this->mutationManager,
$this->subscriptionManager,
], iterator_to_array($this->typeManagers));
$cacheTags = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) {
return Cache::mergeTags($carry, $current
->getCacheTags());
}, []);
$cacheContexts = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) {
return Cache::mergeContexts($carry, $current
->getCacheContexts());
}, []);
$cacheMaxAge = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) {
return Cache::mergeMaxAges($carry, $current
->getCacheMaxAge());
}, Cache::PERMANENT);
$this->derivatives[$this->basePluginId] = [
'type_map' => $typeMap,
'type_reference_map' => $typeReferenceMap,
'type_association_map' => $typeAssocationMap,
'field_association_map' => $fieldAssocationMap,
'field_map' => $fieldMap,
'mutation_map' => $mutationMap,
'subscription_map' => $subscriptionMap,
'schema_cache_tags' => $cacheTags,
'schema_cache_contexts' => $cacheContexts,
'schema_cache_max_age' => $cacheMaxAge,
] + $basePluginDefinition;
return $this->derivatives;
}