1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Overblog\GraphQLBundle\Event; |
4
|
|
|
|
5
|
|
|
use Overblog\GraphQLBundle\Definition\Type\ExtensibleSchema; |
6
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
7
|
|
|
|
8
|
|
|
// TODO(mcg-web): remove hack after migrating Symfony >= 4.3 |
9
|
1 |
|
if (EventDispatcherVersionHelper::isForLegacy()) { |
10
|
|
|
final class ExecutorArgumentsEvent extends \Symfony\Component\EventDispatcher\Event |
|
|
|
|
11
|
|
|
{ |
12
|
|
|
/** @var ExtensibleSchema */ |
13
|
|
|
private $schema; |
14
|
|
|
|
15
|
|
|
/** @var string */ |
16
|
|
|
private $requestString; |
17
|
|
|
|
18
|
|
|
/** @var mixed */ |
19
|
|
|
private $rootValue; |
20
|
|
|
|
21
|
|
|
/** @var \ArrayObject */ |
22
|
|
|
private $contextValue; |
23
|
|
|
|
24
|
|
|
/** @var array|null */ |
25
|
|
|
private $variableValue; |
26
|
|
|
|
27
|
|
|
/** @var string|null */ |
28
|
|
|
private $operationName; |
29
|
|
|
|
30
|
|
|
public static function create( |
31
|
|
|
ExtensibleSchema $schema, |
32
|
|
|
$requestString, |
33
|
|
|
\ArrayObject $contextValue, |
34
|
|
|
$rootValue = null, |
35
|
|
|
array $variableValue = null, |
36
|
|
|
$operationName = null |
37
|
|
|
) { |
38
|
|
|
$instance = new static(); |
39
|
|
|
$instance->setSchema($schema); |
40
|
|
|
$instance->setRequestString($requestString); |
41
|
|
|
$instance->setContextValue($contextValue); |
42
|
|
|
$instance->setRootValue($rootValue); |
43
|
|
|
$instance->setVariableValue($variableValue); |
44
|
|
|
$instance->setOperationName($operationName); |
45
|
|
|
|
46
|
|
|
return $instance; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string|null $operationName |
51
|
|
|
*/ |
52
|
|
|
public function setOperationName($operationName = null) |
53
|
|
|
{ |
54
|
|
|
$this->operationName = $operationName; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setContextValue(\ArrayObject $contextValue = null) |
58
|
|
|
{ |
59
|
|
|
$this->contextValue = $contextValue; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param mixed $rootValue |
64
|
|
|
*/ |
65
|
|
|
public function setRootValue($rootValue = null) |
66
|
|
|
{ |
67
|
|
|
$this->rootValue = $rootValue; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $requestString |
72
|
|
|
*/ |
73
|
|
|
public function setRequestString($requestString) |
74
|
|
|
{ |
75
|
|
|
$this->requestString = $requestString; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function setVariableValue(array $variableValue = null) |
79
|
|
|
{ |
80
|
|
|
$this->variableValue = $variableValue; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function setSchema(ExtensibleSchema $schema) |
84
|
|
|
{ |
85
|
|
|
$this->schema = $schema; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return ExtensibleSchema |
90
|
|
|
*/ |
91
|
|
|
public function getSchema() |
92
|
|
|
{ |
93
|
|
|
return $this->schema; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getRequestString() |
100
|
|
|
{ |
101
|
|
|
return $this->requestString; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return array|null |
106
|
|
|
*/ |
107
|
|
|
public function getRootValue() |
108
|
|
|
{ |
109
|
|
|
return $this->rootValue; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return \ArrayObject |
114
|
|
|
*/ |
115
|
|
|
public function getContextValue() |
116
|
|
|
{ |
117
|
|
|
return $this->contextValue; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return array|null |
122
|
|
|
*/ |
123
|
|
|
public function getVariableValue() |
124
|
|
|
{ |
125
|
|
|
return $this->variableValue; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return string|null |
130
|
|
|
*/ |
131
|
|
|
public function getOperationName() |
132
|
|
|
{ |
133
|
|
|
return $this->operationName; |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
} else { |
137
|
|
|
final class ExecutorArgumentsEvent extends Event |
138
|
|
|
{ |
139
|
|
|
/** @var ExtensibleSchema */ |
140
|
|
|
private $schema; |
141
|
|
|
|
142
|
|
|
/** @var string */ |
143
|
|
|
private $requestString; |
144
|
|
|
|
145
|
|
|
/** @var mixed */ |
146
|
|
|
private $rootValue; |
147
|
|
|
|
148
|
|
|
/** @var \ArrayObject */ |
149
|
|
|
private $contextValue; |
150
|
|
|
|
151
|
|
|
/** @var array|null */ |
152
|
|
|
private $variableValue; |
153
|
|
|
|
154
|
|
|
/** @var string|null */ |
155
|
|
|
private $operationName; |
156
|
|
|
|
157
|
86 |
|
public static function create( |
158
|
|
|
ExtensibleSchema $schema, |
159
|
|
|
$requestString, |
160
|
|
|
\ArrayObject $contextValue, |
161
|
|
|
$rootValue = null, |
162
|
|
|
array $variableValue = null, |
163
|
|
|
$operationName = null |
164
|
|
|
) { |
165
|
86 |
|
$instance = new static(); |
166
|
86 |
|
$instance->setSchema($schema); |
167
|
86 |
|
$instance->setRequestString($requestString); |
168
|
86 |
|
$instance->setContextValue($contextValue); |
169
|
86 |
|
$instance->setRootValue($rootValue); |
170
|
86 |
|
$instance->setVariableValue($variableValue); |
171
|
86 |
|
$instance->setOperationName($operationName); |
172
|
|
|
|
173
|
86 |
|
return $instance; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @param string|null $operationName |
178
|
|
|
*/ |
179
|
86 |
|
public function setOperationName($operationName = null) |
180
|
|
|
{ |
181
|
86 |
|
$this->operationName = $operationName; |
182
|
86 |
|
} |
183
|
|
|
|
184
|
86 |
|
public function setContextValue(\ArrayObject $contextValue = null) |
185
|
|
|
{ |
186
|
86 |
|
$this->contextValue = $contextValue; |
187
|
86 |
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param mixed $rootValue |
191
|
|
|
*/ |
192
|
86 |
|
public function setRootValue($rootValue = null) |
193
|
|
|
{ |
194
|
86 |
|
$this->rootValue = $rootValue; |
195
|
86 |
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param string $requestString |
199
|
|
|
*/ |
200
|
86 |
|
public function setRequestString($requestString) |
201
|
|
|
{ |
202
|
86 |
|
$this->requestString = $requestString; |
203
|
86 |
|
} |
204
|
|
|
|
205
|
86 |
|
public function setVariableValue(array $variableValue = null) |
206
|
|
|
{ |
207
|
86 |
|
$this->variableValue = $variableValue; |
208
|
86 |
|
} |
209
|
|
|
|
210
|
86 |
|
public function setSchema(ExtensibleSchema $schema) |
211
|
|
|
{ |
212
|
86 |
|
$this->schema = $schema; |
213
|
86 |
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return ExtensibleSchema |
217
|
|
|
*/ |
218
|
86 |
|
public function getSchema() |
219
|
|
|
{ |
220
|
86 |
|
return $this->schema; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @return string |
225
|
|
|
*/ |
226
|
86 |
|
public function getRequestString() |
227
|
|
|
{ |
228
|
86 |
|
return $this->requestString; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @return array|null |
233
|
|
|
*/ |
234
|
86 |
|
public function getRootValue() |
235
|
|
|
{ |
236
|
86 |
|
return $this->rootValue; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @return \ArrayObject |
241
|
|
|
*/ |
242
|
86 |
|
public function getContextValue() |
243
|
|
|
{ |
244
|
86 |
|
return $this->contextValue; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @return array|null |
249
|
|
|
*/ |
250
|
86 |
|
public function getVariableValue() |
251
|
|
|
{ |
252
|
86 |
|
return $this->variableValue; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @return string|null |
257
|
|
|
*/ |
258
|
86 |
|
public function getOperationName() |
259
|
|
|
{ |
260
|
86 |
|
return $this->operationName; |
261
|
|
|
} |
262
|
|
|
} |
263
|
|
|
} |
264
|
|
|
|