You are here

public function DataProducerPluginBase::resolveField in GraphQL 8.4

Resolves the queried field with the given context.

Parameters

\Drupal\graphql\GraphQL\Execution\FieldContext $field:

Return value

\GraphQL\Deferred|mixed

Overrides DataProducerPluginInterface::resolveField

File

src/Plugin/GraphQL/DataProducer/DataProducerPluginBase.php, line 41

Class

DataProducerPluginBase
Base class for data producers that resolve fields for queries or mutations.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer

Code

public function resolveField(FieldContext $field) {
  if (!method_exists($this, 'resolve')) {
    throw new \LogicException('Missing data producer resolve method.');
  }
  $context = $this
    ->getContextValues();
  return call_user_func_array([
    $this,
    'resolve',
  ], array_values(array_merge($context, [
    $field,
  ])));
}