|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is a part of GraphQL project. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Alexandr Viniychuk <[email protected]> |
|
6
|
|
|
* created: 5/19/16 8:58 AM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Youshido\GraphQL\Execution; |
|
10
|
|
|
|
|
11
|
|
|
use Youshido\GraphQL\Execution\Context\ExecutionContextInterface; |
|
12
|
|
|
use Youshido\GraphQL\Field\AbstractField; |
|
13
|
|
|
use Youshido\GraphQL\Parser\Ast\Field; |
|
14
|
|
|
use Youshido\GraphQL\Type\AbstractType; |
|
15
|
|
|
|
|
16
|
|
|
class ResolveInfo |
|
17
|
|
|
{ |
|
18
|
|
|
/** @var AbstractField */ |
|
19
|
|
|
protected $field; |
|
20
|
|
|
|
|
21
|
|
|
/** @var Field[] */ |
|
22
|
|
|
protected $fieldASTList; |
|
23
|
|
|
|
|
24
|
|
|
/** @var ExecutionContextInterface */ |
|
25
|
|
|
protected $executionContext; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* This property is to be used for DI in various scenario |
|
29
|
|
|
* Added to original class to keep backward compatibility |
|
30
|
|
|
* because of the way AbstractField::resolve has been declared |
|
31
|
|
|
* |
|
32
|
|
|
* @var mixed $container |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $container; |
|
35
|
|
|
|
|
36
|
26 |
|
public function __construct(AbstractField $field, array $fieldASTList, ExecutionContextInterface $executionContext) |
|
37
|
|
|
{ |
|
38
|
26 |
|
$this->field = $field; |
|
39
|
26 |
|
$this->fieldASTList = $fieldASTList; |
|
40
|
26 |
|
$this->executionContext = $executionContext; |
|
41
|
26 |
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return ExecutionContextInterface |
|
45
|
|
|
*/ |
|
46
|
9 |
|
public function getExecutionContext() |
|
47
|
|
|
{ |
|
48
|
9 |
|
return $this->executionContext; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return AbstractField |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function getField() |
|
55
|
|
|
{ |
|
56
|
1 |
|
return $this->field; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return Field[] |
|
61
|
|
|
*/ |
|
62
|
1 |
|
public function getFieldASTList() |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->fieldASTList; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return AbstractType |
|
69
|
|
|
*/ |
|
70
|
3 |
|
public function getReturnType() |
|
71
|
|
|
{ |
|
72
|
3 |
|
return $this->field->getType(); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function setContainer($container) |
|
76
|
|
|
{ |
|
77
|
|
|
$this->container = $container; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getContainer() |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->container; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|