/** * Apply all of $reducers to this query. Example reducer operations: checking for maximum query complexity, * performing look-ahead query planning, etc. * * @param ExecutionContextInterface $executionContext * @param AbstractQueryVisitor[] $reducers */ public function reduceQuery(ExecutionContextInterface $executionContext, array $reducers) { $this->executionContext = $executionContext; $schema = $executionContext->getSchema(); foreach ($reducers as $reducer) { foreach ($executionContext->getRequest()->getAllOperations() as $operation) { $this->doVisit($operation, $operation instanceof Mutation ? $schema->getMutationType() : $schema->getQueryType(), $reducer); } } }
/** * @inheritdoc */ public function __construct(ExecutionContextInterface $executionContext) { $this->executionContext = $executionContext; parent::__construct($executionContext->getSchema()); }