@@ -41,11 +41,11 @@ |
||
41 | 41 | 'resolveField' => function ($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
42 | 42 | $resolver = new ObjectFieldResolver($this->container); |
43 | 43 | $context = ContextBuilder::create($context->getEndpoint()) |
44 | - ->setRoot($root) |
|
45 | - ->setResolveInfo($resolveInfo) |
|
46 | - ->setArgs($args) |
|
47 | - ->setDefinition($definition->getField($resolveInfo->fieldName)) |
|
48 | - ->build(); |
|
44 | + ->setRoot($root) |
|
45 | + ->setResolveInfo($resolveInfo) |
|
46 | + ->setArgs($args) |
|
47 | + ->setDefinition($definition->getField($resolveInfo->fieldName)) |
|
48 | + ->build(); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | return $resolver($root, $args, $context, $resolveInfo); |
@@ -32,13 +32,13 @@ |
||
32 | 32 | [ |
33 | 33 | 'name' => $definition->getName(), |
34 | 34 | 'description' => $definition->getDescription(), |
35 | - 'fields' => function () use ($definition) { |
|
35 | + 'fields' => function() use ($definition) { |
|
36 | 36 | return GraphQLBuilder::resolveFields($definition); |
37 | 37 | }, |
38 | - 'interfaces' => function () use ($definition) { |
|
38 | + 'interfaces' => function() use ($definition) { |
|
39 | 39 | return $this->resolveInterfaces($definition); |
40 | 40 | }, |
41 | - 'resolveField' => function ($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
|
41 | + 'resolveField' => function($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
|
42 | 42 | $resolver = new ObjectFieldResolver($this->container); |
43 | 43 | $context = ContextBuilder::create($context->getEndpoint()) |
44 | 44 | ->setRoot($root) |
@@ -52,11 +52,11 @@ |
||
52 | 52 | 'resolveField' => function ($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
53 | 53 | $resolver = new ObjectFieldResolver($this->container); |
54 | 54 | $context = ContextBuilder::create($context->getEndpoint()) |
55 | - ->setRoot($root) |
|
56 | - ->setResolveInfo($resolveInfo) |
|
57 | - ->setArgs($args) |
|
58 | - ->setDefinition($definition->getField($resolveInfo->fieldName)) |
|
59 | - ->build(); |
|
55 | + ->setRoot($root) |
|
56 | + ->setResolveInfo($resolveInfo) |
|
57 | + ->setArgs($args) |
|
58 | + ->setDefinition($definition->getField($resolveInfo->fieldName)) |
|
59 | + ->build(); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | return $resolver($root, $args, $context, $resolveInfo); |
@@ -46,10 +46,10 @@ |
||
46 | 46 | [ |
47 | 47 | 'name' => $definition->getName(), |
48 | 48 | 'description' => $definition->getDescription(), |
49 | - 'fields' => function () use ($definition) { |
|
49 | + 'fields' => function() use ($definition) { |
|
50 | 50 | return GraphQLBuilder::resolveFields($definition); |
51 | 51 | }, |
52 | - 'resolveField' => function ($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
|
52 | + 'resolveField' => function($root, array $args, ResolverContext $context, ResolveInfo $resolveInfo) use ($definition) { |
|
53 | 53 | $resolver = new ObjectFieldResolver($this->container); |
54 | 54 | $context = ContextBuilder::create($context->getEndpoint()) |
55 | 55 | ->setRoot($root) |
@@ -76,18 +76,18 @@ |
||
76 | 76 | |
77 | 77 | /** @var NodeBuilder $rootNode */ |
78 | 78 | $config->scalarNode('target') |
79 | - ->info('Target node to properly paginate. If is possible will be auto-resolved using naming conventions') |
|
80 | - ->isRequired(); |
|
79 | + ->info('Target node to properly paginate. If is possible will be auto-resolved using naming conventions') |
|
80 | + ->isRequired(); |
|
81 | 81 | $config->variableNode('filters') |
82 | - ->info('Filters configuration'); |
|
82 | + ->info('Filters configuration'); |
|
83 | 83 | $config->variableNode('order_by'); |
84 | 84 | $config->integerNode('limit')->info('Max number of records allowed for first & last')->defaultValue($this->limit); |
85 | 85 | $config->scalarNode('parent_field') |
86 | - ->info('When is used in sub-fields should be the field to filter by parent instance'); |
|
86 | + ->info('When is used in sub-fields should be the field to filter by parent instance'); |
|
87 | 87 | $config->enumNode('parent_relation') |
88 | - ->info('When is used in sub-fields should be the type of relation with the parent field') |
|
89 | - ->defaultValue(self::ONE_TO_MANY) |
|
90 | - ->values([self::ONE_TO_MANY, self::MANY_TO_MANY]); |
|
88 | + ->info('When is used in sub-fields should be the type of relation with the parent field') |
|
89 | + ->defaultValue(self::ONE_TO_MANY) |
|
90 | + ->values([self::ONE_TO_MANY, self::MANY_TO_MANY]); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -48,30 +48,30 @@ discard block |
||
48 | 48 | protected function configureErrorHandling(NodeBuilder $root) |
49 | 49 | { |
50 | 50 | $errorHandling = $root->arrayNode('error_handling') |
51 | - ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
52 | - ->addDefaultsIfNotSet() |
|
53 | - ->children(); |
|
51 | + ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
52 | + ->addDefaultsIfNotSet() |
|
53 | + ->children(); |
|
54 | 54 | |
55 | 55 | $errorHandling->enumNode('validation_messages') |
56 | - ->values(['error', 'payload', 'both']) |
|
57 | - ->info('Where should be displayed validation messages.') |
|
58 | - ->defaultValue('error'); |
|
56 | + ->values(['error', 'payload', 'both']) |
|
57 | + ->info('Where should be displayed validation messages.') |
|
58 | + ->defaultValue('error'); |
|
59 | 59 | |
60 | 60 | //@deprecated since v1.1 snd should be deleted in 2.0, this is a compatibility flag |
61 | 61 | $errorHandling->booleanNode('jwt_auth_failure_compatibility') |
62 | - ->info('Keep BC with oldest version of JWT Authentication errors') |
|
63 | - ->setDeprecated('Since v1.1 and will will be removed in the next mayor release') |
|
64 | - ->defaultFalse(); |
|
62 | + ->info('Keep BC with oldest version of JWT Authentication errors') |
|
63 | + ->setDeprecated('Since v1.1 and will will be removed in the next mayor release') |
|
64 | + ->defaultFalse(); |
|
65 | 65 | |
66 | 66 | $errorHandling->booleanNode('show_trace')->info('Show error trace in debug mode')->defaultFalse(); |
67 | 67 | |
68 | 68 | $errorHandling->scalarNode('formatter') |
69 | - ->info('Formatter is responsible for converting instances of Error to an array') |
|
70 | - ->defaultValue(DefaultErrorFormatter::class); |
|
69 | + ->info('Formatter is responsible for converting instances of Error to an array') |
|
70 | + ->defaultValue(DefaultErrorFormatter::class); |
|
71 | 71 | |
72 | 72 | $errorHandling->scalarNode('handler') |
73 | - ->info('Handler is useful for error filtering and logging.') |
|
74 | - ->defaultValue(DefaultErrorHandler::class); |
|
73 | + ->info('Handler is useful for error filtering and logging.') |
|
74 | + ->defaultValue(DefaultErrorHandler::class); |
|
75 | 75 | |
76 | 76 | $controlledErrors = $errorHandling |
77 | 77 | ->arrayNode('controlled_errors') |
@@ -157,44 +157,44 @@ discard block |
||
157 | 157 | protected function configureEndpoints(NodeBuilder $root) |
158 | 158 | { |
159 | 159 | $endpoints = $root->arrayNode('endpoints') |
160 | - ->useAttributeAsKey('name') |
|
161 | - ->validate() |
|
162 | - ->ifTrue( |
|
163 | - function ($v) { |
|
164 | - return array_key_exists('default', $v); |
|
165 | - } |
|
166 | - )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
167 | - ->end() |
|
168 | - ->arrayPrototype() |
|
169 | - ->children(); |
|
160 | + ->useAttributeAsKey('name') |
|
161 | + ->validate() |
|
162 | + ->ifTrue( |
|
163 | + function ($v) { |
|
164 | + return array_key_exists('default', $v); |
|
165 | + } |
|
166 | + )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
167 | + ->end() |
|
168 | + ->arrayPrototype() |
|
169 | + ->children(); |
|
170 | 170 | |
171 | 171 | $endpoints->arrayNode('roles') |
172 | - ->beforeNormalization() |
|
173 | - ->ifString() |
|
174 | - ->then( |
|
175 | - function ($v) { |
|
176 | - return preg_split('/\s*,\s*/', $v); |
|
177 | - } |
|
178 | - ) |
|
179 | - ->end() |
|
180 | - ->prototype('scalar') |
|
181 | - ->end(); |
|
172 | + ->beforeNormalization() |
|
173 | + ->ifString() |
|
174 | + ->then( |
|
175 | + function ($v) { |
|
176 | + return preg_split('/\s*,\s*/', $v); |
|
177 | + } |
|
178 | + ) |
|
179 | + ->end() |
|
180 | + ->prototype('scalar') |
|
181 | + ->end(); |
|
182 | 182 | |
183 | 183 | $endpoints->scalarNode('host')->example('^api\.backend\.'); |
184 | 184 | $endpoints->scalarNode('path')->example('/backend'); |
185 | 185 | |
186 | 186 | $root->arrayNode('endpoint_alias') |
187 | - ->info('Use alias to refer to multiple endpoints using only one name') |
|
188 | - ->useAttributeAsKey('name') |
|
189 | - ->beforeNormalization() |
|
190 | - ->ifString() |
|
191 | - ->then( |
|
192 | - function ($v) { |
|
193 | - return preg_split('/\s*,\s*/', $v); |
|
194 | - } |
|
195 | - ) |
|
196 | - ->end() |
|
197 | - ->variablePrototype(); |
|
187 | + ->info('Use alias to refer to multiple endpoints using only one name') |
|
188 | + ->useAttributeAsKey('name') |
|
189 | + ->beforeNormalization() |
|
190 | + ->ifString() |
|
191 | + ->then( |
|
192 | + function ($v) { |
|
193 | + return preg_split('/\s*,\s*/', $v); |
|
194 | + } |
|
195 | + ) |
|
196 | + ->end() |
|
197 | + ->variablePrototype(); |
|
198 | 198 | |
199 | 199 | $root->scalarNode('endpoint_default')->info('Endpoint to apply to all definitions without explicit endpoint.'); |
200 | 200 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $graphiql = $root->arrayNode('graphiql')->addDefaultsIfNotSet()->children(); |
206 | 206 | |
207 | 207 | $graphiql->scalarNode('title') |
208 | - ->defaultValue('GraphQL API Explorer'); |
|
208 | + ->defaultValue('GraphQL API Explorer'); |
|
209 | 209 | |
210 | 210 | $graphiql |
211 | 211 | ->scalarNode('data_warning_message') |
@@ -233,61 +233,61 @@ discard block |
||
233 | 233 | ->defaultFalse(); |
234 | 234 | |
235 | 235 | $authentication->scalarNode('login_message') |
236 | - ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
236 | + ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
237 | 237 | |
238 | 238 | $authenticationProvider = $authentication->arrayNode('provider')->children(); |
239 | 239 | |
240 | 240 | //the updated version of `jwt` to use lexik authentication bundle |
241 | 241 | $lexikJwt = $authenticationProvider->arrayNode('lexik_jwt') |
242 | - ->canBeEnabled() |
|
243 | - ->children(); |
|
242 | + ->canBeEnabled() |
|
243 | + ->children(); |
|
244 | 244 | |
245 | 245 | $lexikJwt->scalarNode('user_provider') |
246 | - ->isRequired() |
|
247 | - ->info('Name of the user provider to use'); |
|
246 | + ->isRequired() |
|
247 | + ->info('Name of the user provider to use'); |
|
248 | 248 | |
249 | 249 | $lexikJwt->scalarNode('username_label') |
250 | - ->defaultValue('Username'); |
|
250 | + ->defaultValue('Username'); |
|
251 | 251 | |
252 | 252 | $lexikJwt->scalarNode('password_label') |
253 | - ->defaultValue('Password'); |
|
253 | + ->defaultValue('Password'); |
|
254 | 254 | |
255 | 255 | $authenticationProvider->scalarNode('custom') |
256 | - ->defaultNull() |
|
257 | - ->info('Configure custom service to use as authentication provider'); |
|
256 | + ->defaultNull() |
|
257 | + ->info('Configure custom service to use as authentication provider'); |
|
258 | 258 | |
259 | 259 | //deprecated since v1.1 and should be deleted in v2.0 |
260 | 260 | $jwt = $authenticationProvider->arrayNode('jwt') |
261 | - ->setDeprecated('Use lexik_jwt instead, this provider will be removed in the next mayor release.') |
|
262 | - ->canBeEnabled() |
|
263 | - ->children(); |
|
261 | + ->setDeprecated('Use lexik_jwt instead, this provider will be removed in the next mayor release.') |
|
262 | + ->canBeEnabled() |
|
263 | + ->children(); |
|
264 | 264 | |
265 | 265 | $jwtLogin = $jwt->arrayNode('login')->children(); |
266 | 266 | |
267 | 267 | $jwtLogin->scalarNode('url') |
268 | - ->info('Route name or URI to make the login process to retrieve the token.') |
|
269 | - ->isRequired(); |
|
268 | + ->info('Route name or URI to make the login process to retrieve the token.') |
|
269 | + ->isRequired(); |
|
270 | 270 | |
271 | 271 | $jwtLogin->scalarNode('username_parameter') |
272 | - ->defaultValue('username'); |
|
272 | + ->defaultValue('username'); |
|
273 | 273 | |
274 | 274 | $jwtLogin->scalarNode('username_label') |
275 | - ->defaultValue('Username'); |
|
275 | + ->defaultValue('Username'); |
|
276 | 276 | |
277 | 277 | $jwtLogin->scalarNode('password_parameter') |
278 | - ->defaultValue('password'); |
|
278 | + ->defaultValue('password'); |
|
279 | 279 | |
280 | 280 | $jwtLogin->scalarNode('password_label') |
281 | - ->defaultValue('Password'); |
|
281 | + ->defaultValue('Password'); |
|
282 | 282 | |
283 | 283 | $jwtLogin->enumNode('parameters_in') |
284 | - ->values(['form', 'query', 'header']) |
|
285 | - ->info('How pass parameters to request the token') |
|
286 | - ->defaultValue('form'); |
|
284 | + ->values(['form', 'query', 'header']) |
|
285 | + ->info('How pass parameters to request the token') |
|
286 | + ->defaultValue('form'); |
|
287 | 287 | |
288 | 288 | $jwtLogin->scalarNode('response_token_path') |
289 | - ->defaultValue('token') |
|
290 | - ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
289 | + ->defaultValue('token') |
|
290 | + ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
291 | 291 | |
292 | 292 | $jwtRequests = $jwt->arrayNode('requests')->addDefaultsIfNotSet()->children(); |
293 | 293 | |
@@ -326,25 +326,25 @@ discard block |
||
326 | 326 | { |
327 | 327 | $pagination = $root->arrayNode('pagination')->addDefaultsIfNotSet()->children(); |
328 | 328 | $pagination->integerNode('limit') |
329 | - ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
329 | + ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | protected function configurePluginNamespaceGlobalConfig(NodeBuilder $root) |
333 | 333 | { |
334 | 334 | $namespaces = $root->arrayNode('namespaces') |
335 | - ->info( |
|
336 | - 'Group GraphQL schema using namespaced schemas. |
|
335 | + ->info( |
|
336 | + 'Group GraphQL schema using namespaced schemas. |
|
337 | 337 | On large schemas is helpful to keep schemas grouped by bundle and node' |
338 | - ) |
|
339 | - ->canBeEnabled() |
|
340 | - ->addDefaultsIfNotSet() |
|
341 | - ->children(); |
|
338 | + ) |
|
339 | + ->canBeEnabled() |
|
340 | + ->addDefaultsIfNotSet() |
|
341 | + ->children(); |
|
342 | 342 | |
343 | 343 | $bundles = $namespaces->arrayNode('bundles') |
344 | - ->info('Group each bundle into a separate schema definition') |
|
345 | - ->canBeDisabled() |
|
346 | - ->addDefaultsIfNotSet() |
|
347 | - ->children(); |
|
344 | + ->info('Group each bundle into a separate schema definition') |
|
345 | + ->canBeDisabled() |
|
346 | + ->addDefaultsIfNotSet() |
|
347 | + ->children(); |
|
348 | 348 | |
349 | 349 | $bundles->scalarNode('query_suffix') |
350 | 350 | ->info('The following suffix will be used for bundle query groups') |
@@ -375,25 +375,25 @@ discard block |
||
375 | 375 | ->children(); |
376 | 376 | |
377 | 377 | $nodes->scalarNode('query_suffix') |
378 | - ->info('The following suffix will be used to create the name for queries to the same node') |
|
379 | - ->defaultValue('Query'); |
|
378 | + ->info('The following suffix will be used to create the name for queries to the same node') |
|
379 | + ->defaultValue('Query'); |
|
380 | 380 | |
381 | 381 | $nodes->scalarNode('mutation_suffix') |
382 | - ->info('The following suffix will be used to create the name for mutations to the same node') |
|
383 | - ->defaultValue('Mutation'); |
|
382 | + ->info('The following suffix will be used to create the name for mutations to the same node') |
|
383 | + ->defaultValue('Mutation'); |
|
384 | 384 | |
385 | 385 | $nodes->variableNode('ignore') |
386 | - ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
387 | - ->defaultValue(['Node']); |
|
386 | + ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
387 | + ->defaultValue(['Node']); |
|
388 | 388 | |
389 | 389 | $nodes->arrayNode('aliases') |
390 | - ->info( |
|
391 | - 'Define aliases for nodes to set definitions inside other desired node name. |
|
390 | + ->info( |
|
391 | + 'Define aliases for nodes to set definitions inside other desired node name. |
|
392 | 392 | Can be used to group multiple nodes or publish a node with a different group name' |
393 | - ) |
|
394 | - ->example('InvoiceItem: Invoice') |
|
395 | - ->useAttributeAsKey('name') |
|
396 | - ->prototype('scalar'); |
|
393 | + ) |
|
394 | + ->example('InvoiceItem: Invoice') |
|
395 | + ->useAttributeAsKey('name') |
|
396 | + ->prototype('scalar'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | private function configureSecurity(NodeBuilder $rootNode) |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | ->children(); |
440 | 440 | |
441 | 441 | $bcNode->variableNode('filters') |
442 | - ->info('Keep deprecated "filters" argument in collections') |
|
443 | - ->setDeprecated('v1.2') |
|
444 | - ->defaultFalse(); |
|
442 | + ->info('Keep deprecated "filters" argument in collections') |
|
443 | + ->setDeprecated('v1.2') |
|
444 | + ->defaultFalse(); |
|
445 | 445 | |
446 | 446 | $bcNode->variableNode('orderBy') |
447 | - ->info('Keep deprecated "orderBy" argument in collections') |
|
448 | - ->setDeprecated('v1.2') |
|
449 | - ->defaultFalse(); |
|
447 | + ->info('Keep deprecated "orderBy" argument in collections') |
|
448 | + ->setDeprecated('v1.2') |
|
449 | + ->defaultFalse(); |
|
450 | 450 | } |
451 | 451 | } |
@@ -129,11 +129,11 @@ |
||
129 | 129 | |
130 | 130 | if ($resolver && $refMethod) { |
131 | 131 | $this->context = ContextBuilder::create($context->getEndpoint()) |
132 | - ->setRoot($root) |
|
133 | - ->setResolveInfo($resolveInfo) |
|
134 | - ->setArgs($args) |
|
135 | - ->setDefinition($this->executableDefinition) |
|
136 | - ->build(); |
|
132 | + ->setRoot($root) |
|
133 | + ->setResolveInfo($resolveInfo) |
|
134 | + ->setArgs($args) |
|
135 | + ->setDefinition($this->executableDefinition) |
|
136 | + ->build(); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | if ($resolver instanceof ResolverInterface) { |
@@ -88,11 +88,11 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $context = ContextBuilder::create($context->getEndpoint()) |
91 | - ->setArgs($args) |
|
92 | - ->setRoot($root) |
|
93 | - ->setDefinition($queryDefinition) |
|
94 | - ->setResolveInfo($info) |
|
95 | - ->build(); |
|
91 | + ->setArgs($args) |
|
92 | + ->setRoot($root) |
|
93 | + ->setDefinition($queryDefinition) |
|
94 | + ->setResolveInfo($info) |
|
95 | + ->build(); |
|
96 | 96 | |
97 | 97 | $resolver = new ResolverExecutor($this->container, $queryDefinition); |
98 | 98 | $value = $resolver($root, $args, $context, $info); |