static function getSelectByResolveInfo(ResolveInfo $info) { return array_map(function ($item) { /** @var Field|Query $item */ return $item->getName(); }, $info->getFieldASTList()); }
public function resolve($value, array $args, ResolveInfo $info) { if ($value) { if ($value instanceof ODMImageableInterface || $value instanceof ORMImageableInterface || method_exists('getImage', $value)) { if ($image = $value->getImage()) { return ['id' => $image instanceof EmbeddedImage ? $image->getReferenceId() : $image->getId(), 'url' => $info->getContainer()->get('api_images.path_resolver')->resolveWebPath($image), 'image' => $image]; } } } return null; }
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()); }
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; }
public function resolve($value, array $args, ResolveInfo $info) { return $info->getExecutionContext()->getSchema(); }
public function resolve($value, array $args, ResolveInfo $info) { $image = $info->getContainer()->get('api_images.provider')->getOne($args['id']); return ['id' => $image->getId(), 'url' => $info->getContainer()->get('api_images.path_resolver')->resolveWebPath($image), 'image' => $image]; }
/** * @param null $value * @param array $args * @param ResolveInfo $info * @return mixed */ public function resolve($value, array $args, ResolveInfo $info) { return $info->getReturnType()->getOne($args['id']); }
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; }