You are here

public function QueryProcessor::processQuery in GraphQL 8.3

Processes one or multiple graphql operations.

Parameters

string $schema: The plugin id of the schema to use.

\GraphQL\Server\OperationParams|\GraphQL\Server\OperationParams[] $params: The graphql operation(s) to execute.

Return value

\Drupal\graphql\GraphQL\Execution\QueryResult|\Drupal\graphql\GraphQL\Execution\QueryResult[] The query result.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

src/GraphQL/Execution/QueryProcessor.php, line 100

Class

QueryProcessor

Namespace

Drupal\graphql\GraphQL\Execution

Code

public function processQuery($schema, $params) {

  // Load the plugin from the schema manager.
  $plugin = $this->pluginManager
    ->createInstance($schema);
  $config = $plugin
    ->getServer();
  if (is_array($params)) {
    return $this
      ->executeBatch($config, $params);
  }
  return $this
    ->executeSingle($config, $params);
}