protected function PluggableSchemaDeriver::buildTypeReferenceMap in GraphQL 8.3
Builds an optimized map of data type and type name references.
Parameters
array $types: The list of types registered with any of the plugin managers.
Return value
array The optimized list of data type to type name references.
1 call to PluggableSchemaDeriver::buildTypeReferenceMap()
- PluggableSchemaDeriver::getDerivativeDefinitions in src/
Plugin/ Deriver/ PluggableSchemaDeriver.php - Gets the definition of all derivatives of a base plugin.
File
- src/
Plugin/ Deriver/ PluggableSchemaDeriver.php, line 198
Class
Namespace
Drupal\graphql\Plugin\DeriverCode
protected function buildTypeReferenceMap(array $types) {
$references = array_reduce(array_keys($types), function ($references, $name) use ($types) {
$current = $types[$name];
$reference = $current['reference'];
if (!empty($reference) && (empty($references[$reference]) || $references[$reference]['weight'] < $current['weight'])) {
$references[$reference] = [
'name' => $name,
'weight' => !empty($current['weight']) ? $current['weight'] : 0,
];
}
return $references;
}, []);
return array_map(function ($reference) {
return $reference['name'];
}, $references);
}