getExecutionContext() публичный Метод

public getExecutionContext ( ) : Youshido\GraphQL\Execution\Context\ExecutionContextInterface
Результат Youshido\GraphQL\Execution\Context\ExecutionContextInterface
Пример #1
0
 public function testMethods()
 {
     $fieldAst = new FieldAST('name', null, [], new Location(1, 1));
     $field = new Field(['name' => 'id', 'type' => new IntType()]);
     $returnType = new IntType();
     $executionContext = new ExecutionContext(new TestSchema());
     $info = new ResolveInfo($field, [$fieldAst], $executionContext);
     $this->assertEquals($field, $info->getField());
     $this->assertEquals([$fieldAst], $info->getFieldASTList());
     $this->assertEquals($returnType, $info->getReturnType());
     $this->assertEquals($executionContext, $info->getExecutionContext());
 }
Пример #2
0
 public function resolve($value = null, array $args, ResolveInfo $info)
 {
     $schema = $info->getExecutionContext()->getSchema();
     $this->collectTypes($schema->getQueryType());
     $this->collectTypes($schema->getMutationType());
     foreach ($schema->getTypesList()->getTypes() as $type) {
         $this->collectTypes($type);
     }
     foreach ($this->types as $name => $info) {
         if ($name == $args['name']) {
             return $info;
         }
     }
     return null;
 }
Пример #3
0
 public function resolve($value, array $args, ResolveInfo $info)
 {
     return $info->getExecutionContext()->getSchema();
 }
Пример #4
0
 public function resolvePossibleTypes($value, $args, ResolveInfo $info)
 {
     /** @var $value AbstractObjectType */
     if ($value->getKind() == TypeMap::KIND_INTERFACE) {
         $this->collectTypes($info->getExecutionContext()->getSchema()->getQueryType());
         $possibleTypes = [];
         foreach ($this->types as $type) {
             /** @var $type AbstractObjectType */
             if ($type->getKind() == TypeMap::KIND_OBJECT) {
                 $interfaces = $type->getConfig()->getInterfaces();
                 if ($interfaces) {
                     foreach ($interfaces as $interface) {
                         if ($interface->getName() == $value->getName()) {
                             $possibleTypes[] = $type;
                         }
                     }
                 }
             }
         }
         return $possibleTypes;
     } elseif ($value->getKind() == TypeMap::KIND_UNION) {
         /** @var $value AbstractUnionType */
         return $value->getTypes();
     }
     return null;
 }