public function ResolverRegistry::resolveType in GraphQL 8.4
Resolve a type.
Parameters
mixed $value:
\Drupal\graphql\GraphQL\Execution\ResolveContext $context:
\GraphQL\Type\Definition\ResolveInfo $info:
Return value
callable|null
Overrides ResolverRegistryInterface::resolveType
File
- src/
GraphQL/ ResolverRegistry.php, line 90
Class
- ResolverRegistry
- Contains all the mappings how to resolve a GraphQL request.
Namespace
Drupal\graphql\GraphQLCode
public function resolveType($value, ResolveContext $context, ResolveInfo $info) {
// First, check if there is a resolver registered for this abstract type.
if ($resolver = $this
->getRuntimeTypeResolver($value, $context, $info)) {
if (!is_callable($resolver)) {
throw new \LogicException(sprintf('Type resolver for type %s is not callable.', $info->parentType->name));
}
if (($type = $resolver($value, $context, $info)) !== NULL) {
return $type;
}
}
return call_user_func($this->defaultTypeResolver, $value, $context, $info);
}