Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
QueryProcessor Class Reference

Public Member Functions

 __construct (ExceptionFormatter $exceptionFormatter)
 
 process (Schema $schema, string $source, ContextInterface $contextValue=null, array $variableValues=null, string $operationName=null)
 

Detailed Description

Wrapper for GraphQl execution of a schema

Definition at line 20 of file QueryProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ExceptionFormatter  $exceptionFormatter)
Parameters
ExceptionFormatter$exceptionFormatter

Definition at line 30 of file QueryProcessor.php.

31  {
32  $this->exceptionFormatter = $exceptionFormatter;
33  }

Member Function Documentation

◆ process()

process ( Schema  $schema,
string  $source,
ContextInterface  $contextValue = null,
array  $variableValues = null,
string  $operationName = null 
)

Process a GraphQl query according to defined schema

Parameters
Schema$schema
string$source
ContextInterface$contextValue
array | null$variableValues
string | null$operationName
Returns
Promise|array

Definition at line 45 of file QueryProcessor.php.

51  : array {
52  if (!$this->exceptionFormatter->shouldShowDetail()) {
53  DocumentValidator::addRule(new QueryDepth(10));
54  DocumentValidator::addRule(new DisableIntrospection());
55  }
56  $rootValue = null;
57  return \GraphQL\GraphQL::executeQuery(
58  $schema,
59  $source,
60  $rootValue,
61  $contextValue,
62  $variableValues,
63  $operationName
64  )->toArray(
65  $this->exceptionFormatter->shouldShowDetail() ?
66  \GraphQL\Error\Debug::INCLUDE_DEBUG_MESSAGE | \GraphQL\Error\Debug::INCLUDE_TRACE : false
67  );
68  }
return false
Definition: gallery.phtml:36
$source
Definition: source.php:23

The documentation for this class was generated from the following file: