public function Composite::resolve in GraphQL 8.4
Resolve values for the fields.
Parameters
mixed $value:
mixed $args:
\Drupal\graphql\GraphQL\Execution\ResolveContext $context:
\GraphQL\Type\Definition\ResolveInfo $info:
\Drupal\graphql\GraphQL\Execution\FieldContext $field:
Return value
mixed
Overrides ResolverInterface::resolve
File
- src/
GraphQL/ Resolver/ Composite.php, line 45
Class
- Composite
- Resolves by calling a chain of resolvers after each other.
Namespace
Drupal\graphql\GraphQL\ResolverCode
public function resolve($value, $args, ResolveContext $context, ResolveInfo $info, FieldContext $field) {
$resolvers = $this->resolvers;
while ($resolver = array_shift($resolvers)) {
$value = $resolver
->resolve($value, $args, $context, $info, $field);
if ($value instanceof SyncPromise) {
return DeferredUtility::returnFinally($value, function ($value) use ($resolvers, $args, $context, $info, $field) {
return isset($value) ? (new Composite($resolvers))
->resolve($value, $args, $context, $info, $field) : NULL;
});
}
}
return $value;
}