You are here

protected function ResolverRegistry::getRuntimeFieldResolverOnInterface in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.0.x modules/custom/social_graphql/src/GraphQL/ResolverRegistry.php \Drupal\social_graphql\GraphQL\ResolverRegistry::getRuntimeFieldResolverOnInterface()

Attempts to find a resolver on an implemented interface.

Parameters

mixed $value: Value passed by getRuntimeFieldResolver.

string $args: Args passed by getRuntimeFieldResolver.

\Drupal\graphql\GraphQL\Execution\ResolveContext $context: Context passed by getRuntimeFieldResolver.

\GraphQL\Type\Definition\ResolveInfo $info: Info passed by getRuntimeFieldResolver.

Return value

callable|null The resolver for the field or null if none was found.

1 call to ResolverRegistry::getRuntimeFieldResolverOnInterface()
ResolverRegistry::getRuntimeFieldResolver in modules/custom/social_graphql/src/GraphQL/ResolverRegistry.php

File

modules/custom/social_graphql/src/GraphQL/ResolverRegistry.php, line 93

Class

ResolverRegistry
The Open Social resolver registry.

Namespace

Drupal\social_graphql\GraphQL

Code

protected function getRuntimeFieldResolverOnInterface($value, $args, ResolveContext $context, ResolveInfo $info) {

  // Go through the interfaces implemented for the type on which this field is
  // resolved and check if they lead to a field resolution.
  $interfaces = $info->parentType
    ->getInterfaces();
  foreach ($interfaces as $interface) {
    if ($resolver = $this
      ->getFieldResolver($interface->name, $info->fieldName)) {
      return $resolver;
    }
  }
  return NULL;
}