Youshido\GraphQL\Execution\Processor::resolveQuery PHP Method

resolveQuery() protected method

protected resolveQuery ( Query $query )
$query Youshido\GraphQL\Parser\Ast\Query
    protected function resolveQuery(AstQuery $query)
    {
        $schema = $this->executionContext->getSchema();
        $type = $query instanceof AstMutation ? $schema->getMutationType() : $schema->getQueryType();
        $field = new Field(['name' => $query instanceof AstMutation ? 'mutation' : 'query', 'type' => $type]);
        if (self::TYPE_NAME_QUERY == $query->getName()) {
            return [$this->getAlias($query) => $type->getName()];
        }
        $this->resolveValidator->assetTypeHasField($type, $query);
        $value = $this->resolveField($field, $query);
        return [$this->getAlias($query) => $value];
    }

Usage Example

Esempio n. 1
0
 protected function resolveQuery(Query $query)
 {
     $this->assertClientHasOperationAccess($query);
     return parent::resolveQuery($query);
 }