@@ -47,30 +47,30 @@ discard block |
||
| 47 | 47 | protected function configureErrorHandling(NodeBuilder $root) |
| 48 | 48 | { |
| 49 | 49 | $errorHandling = $root->arrayNode('error_handling') |
| 50 | - ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
| 51 | - ->addDefaultsIfNotSet() |
|
| 52 | - ->children(); |
|
| 50 | + ->info('It is important to handle errors and when possible, report these errors back to your users for information. ') |
|
| 51 | + ->addDefaultsIfNotSet() |
|
| 52 | + ->children(); |
|
| 53 | 53 | |
| 54 | 54 | $errorHandling->enumNode('validation_messages') |
| 55 | - ->values(['error', 'payload', 'both']) |
|
| 56 | - ->info('Where should be displayed validation messages.') |
|
| 57 | - ->defaultValue('error'); |
|
| 55 | + ->values(['error', 'payload', 'both']) |
|
| 56 | + ->info('Where should be displayed validation messages.') |
|
| 57 | + ->defaultValue('error'); |
|
| 58 | 58 | |
| 59 | 59 | //@deprecated since v1.1 snd should be deleted in 2.0, this is a compatibility flag |
| 60 | 60 | $errorHandling->booleanNode('jwt_auth_failure_compatibility') |
| 61 | - ->info('Keep BC with oldest version of JWT Authentication errors') |
|
| 62 | - ->setDeprecated('Since v1.1 and will will be removed in the next mayor release') |
|
| 63 | - ->defaultFalse(); |
|
| 61 | + ->info('Keep BC with oldest version of JWT Authentication errors') |
|
| 62 | + ->setDeprecated('Since v1.1 and will will be removed in the next mayor release') |
|
| 63 | + ->defaultFalse(); |
|
| 64 | 64 | |
| 65 | 65 | $errorHandling->booleanNode('show_trace')->info('Show error trace in debug mode')->defaultFalse(); |
| 66 | 66 | |
| 67 | 67 | $errorHandling->scalarNode('formatter') |
| 68 | - ->info('Formatter is responsible for converting instances of Error to an array') |
|
| 69 | - ->defaultValue(DefaultErrorFormatter::class); |
|
| 68 | + ->info('Formatter is responsible for converting instances of Error to an array') |
|
| 69 | + ->defaultValue(DefaultErrorFormatter::class); |
|
| 70 | 70 | |
| 71 | 71 | $errorHandling->scalarNode('handler') |
| 72 | - ->info('Handler is useful for error filtering and logging.') |
|
| 73 | - ->defaultValue(DefaultErrorHandler::class); |
|
| 72 | + ->info('Handler is useful for error filtering and logging.') |
|
| 73 | + ->defaultValue(DefaultErrorHandler::class); |
|
| 74 | 74 | |
| 75 | 75 | $controlledErrors = $errorHandling |
| 76 | 76 | ->arrayNode('controlled_errors') |
@@ -156,44 +156,44 @@ discard block |
||
| 156 | 156 | protected function configureEndpoints(NodeBuilder $root) |
| 157 | 157 | { |
| 158 | 158 | $endpoints = $root->arrayNode('endpoints') |
| 159 | - ->useAttributeAsKey('name') |
|
| 160 | - ->validate() |
|
| 161 | - ->ifTrue( |
|
| 162 | - function ($v) { |
|
| 163 | - return array_key_exists('default', $v); |
|
| 164 | - } |
|
| 165 | - )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
| 166 | - ->end() |
|
| 167 | - ->arrayPrototype() |
|
| 168 | - ->children(); |
|
| 159 | + ->useAttributeAsKey('name') |
|
| 160 | + ->validate() |
|
| 161 | + ->ifTrue( |
|
| 162 | + function ($v) { |
|
| 163 | + return array_key_exists('default', $v); |
|
| 164 | + } |
|
| 165 | + )->thenInvalid('"default" can\'t be used as endpoint name, the system internally use this endpoint name to store the entire schema.') |
|
| 166 | + ->end() |
|
| 167 | + ->arrayPrototype() |
|
| 168 | + ->children(); |
|
| 169 | 169 | |
| 170 | 170 | $endpoints->arrayNode('roles') |
| 171 | - ->beforeNormalization() |
|
| 172 | - ->ifString() |
|
| 173 | - ->then( |
|
| 174 | - function ($v) { |
|
| 175 | - return preg_split('/\s*,\s*/', $v); |
|
| 176 | - } |
|
| 177 | - ) |
|
| 178 | - ->end() |
|
| 179 | - ->prototype('scalar') |
|
| 180 | - ->end(); |
|
| 171 | + ->beforeNormalization() |
|
| 172 | + ->ifString() |
|
| 173 | + ->then( |
|
| 174 | + function ($v) { |
|
| 175 | + return preg_split('/\s*,\s*/', $v); |
|
| 176 | + } |
|
| 177 | + ) |
|
| 178 | + ->end() |
|
| 179 | + ->prototype('scalar') |
|
| 180 | + ->end(); |
|
| 181 | 181 | |
| 182 | 182 | $endpoints->scalarNode('host')->example('^api\.backend\.'); |
| 183 | 183 | $endpoints->scalarNode('path')->example('/backend'); |
| 184 | 184 | |
| 185 | 185 | $root->arrayNode('endpoint_alias') |
| 186 | - ->info('Use alias to refer to multiple endpoints using only one name') |
|
| 187 | - ->useAttributeAsKey('name') |
|
| 188 | - ->beforeNormalization() |
|
| 189 | - ->ifString() |
|
| 190 | - ->then( |
|
| 191 | - function ($v) { |
|
| 192 | - return preg_split('/\s*,\s*/', $v); |
|
| 193 | - } |
|
| 194 | - ) |
|
| 195 | - ->end() |
|
| 196 | - ->variablePrototype(); |
|
| 186 | + ->info('Use alias to refer to multiple endpoints using only one name') |
|
| 187 | + ->useAttributeAsKey('name') |
|
| 188 | + ->beforeNormalization() |
|
| 189 | + ->ifString() |
|
| 190 | + ->then( |
|
| 191 | + function ($v) { |
|
| 192 | + return preg_split('/\s*,\s*/', $v); |
|
| 193 | + } |
|
| 194 | + ) |
|
| 195 | + ->end() |
|
| 196 | + ->variablePrototype(); |
|
| 197 | 197 | |
| 198 | 198 | $root->scalarNode('endpoint_default')->info('Endpoint to apply to all definitions without explicit endpoint.'); |
| 199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $graphiql = $root->arrayNode('graphiql')->addDefaultsIfNotSet()->children(); |
| 205 | 205 | |
| 206 | 206 | $graphiql->scalarNode('title') |
| 207 | - ->defaultValue('GraphQL API Explorer'); |
|
| 207 | + ->defaultValue('GraphQL API Explorer'); |
|
| 208 | 208 | |
| 209 | 209 | $graphiql |
| 210 | 210 | ->scalarNode('data_warning_message') |
@@ -232,61 +232,61 @@ discard block |
||
| 232 | 232 | ->defaultFalse(); |
| 233 | 233 | |
| 234 | 234 | $authentication->scalarNode('login_message') |
| 235 | - ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
| 235 | + ->defaultValue('Start exploring GraphQL API queries using your account’s data now.'); |
|
| 236 | 236 | |
| 237 | 237 | $authenticationProvider = $authentication->arrayNode('provider')->children(); |
| 238 | 238 | |
| 239 | 239 | //the updated version of `jwt` to use lexik authentication bundle |
| 240 | 240 | $lexikJwt = $authenticationProvider->arrayNode('lexik_jwt') |
| 241 | - ->canBeEnabled() |
|
| 242 | - ->children(); |
|
| 241 | + ->canBeEnabled() |
|
| 242 | + ->children(); |
|
| 243 | 243 | |
| 244 | 244 | $lexikJwt->scalarNode('user_provider') |
| 245 | - ->isRequired() |
|
| 246 | - ->info('Name of the user provider to use'); |
|
| 245 | + ->isRequired() |
|
| 246 | + ->info('Name of the user provider to use'); |
|
| 247 | 247 | |
| 248 | 248 | $lexikJwt->scalarNode('username_label') |
| 249 | - ->defaultValue('Username'); |
|
| 249 | + ->defaultValue('Username'); |
|
| 250 | 250 | |
| 251 | 251 | $lexikJwt->scalarNode('password_label') |
| 252 | - ->defaultValue('Password'); |
|
| 252 | + ->defaultValue('Password'); |
|
| 253 | 253 | |
| 254 | 254 | $authenticationProvider->scalarNode('custom') |
| 255 | - ->defaultNull() |
|
| 256 | - ->info('Configure custom service to use as authentication provider'); |
|
| 255 | + ->defaultNull() |
|
| 256 | + ->info('Configure custom service to use as authentication provider'); |
|
| 257 | 257 | |
| 258 | 258 | //deprecated since v1.1 and should be deleted in v2.0 |
| 259 | 259 | $jwt = $authenticationProvider->arrayNode('jwt') |
| 260 | - ->setDeprecated('Use lexik_jwt instead, this provider will be removed in the next mayor release.') |
|
| 261 | - ->canBeEnabled() |
|
| 262 | - ->children(); |
|
| 260 | + ->setDeprecated('Use lexik_jwt instead, this provider will be removed in the next mayor release.') |
|
| 261 | + ->canBeEnabled() |
|
| 262 | + ->children(); |
|
| 263 | 263 | |
| 264 | 264 | $jwtLogin = $jwt->arrayNode('login')->children(); |
| 265 | 265 | |
| 266 | 266 | $jwtLogin->scalarNode('url') |
| 267 | - ->info('Route name or URI to make the login process to retrieve the token.') |
|
| 268 | - ->isRequired(); |
|
| 267 | + ->info('Route name or URI to make the login process to retrieve the token.') |
|
| 268 | + ->isRequired(); |
|
| 269 | 269 | |
| 270 | 270 | $jwtLogin->scalarNode('username_parameter') |
| 271 | - ->defaultValue('username'); |
|
| 271 | + ->defaultValue('username'); |
|
| 272 | 272 | |
| 273 | 273 | $jwtLogin->scalarNode('username_label') |
| 274 | - ->defaultValue('Username'); |
|
| 274 | + ->defaultValue('Username'); |
|
| 275 | 275 | |
| 276 | 276 | $jwtLogin->scalarNode('password_parameter') |
| 277 | - ->defaultValue('password'); |
|
| 277 | + ->defaultValue('password'); |
|
| 278 | 278 | |
| 279 | 279 | $jwtLogin->scalarNode('password_label') |
| 280 | - ->defaultValue('Password'); |
|
| 280 | + ->defaultValue('Password'); |
|
| 281 | 281 | |
| 282 | 282 | $jwtLogin->enumNode('parameters_in') |
| 283 | - ->values(['form', 'query', 'header']) |
|
| 284 | - ->info('How pass parameters to request the token') |
|
| 285 | - ->defaultValue('form'); |
|
| 283 | + ->values(['form', 'query', 'header']) |
|
| 284 | + ->info('How pass parameters to request the token') |
|
| 285 | + ->defaultValue('form'); |
|
| 286 | 286 | |
| 287 | 287 | $jwtLogin->scalarNode('response_token_path') |
| 288 | - ->defaultValue('token') |
|
| 289 | - ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
| 288 | + ->defaultValue('token') |
|
| 289 | + ->info('Where the token should be located in the response in case of JSON, set null if the response is the token.'); |
|
| 290 | 290 | |
| 291 | 291 | $jwtRequests = $jwt->arrayNode('requests')->addDefaultsIfNotSet()->children(); |
| 292 | 292 | |
@@ -325,25 +325,25 @@ discard block |
||
| 325 | 325 | { |
| 326 | 326 | $pagination = $root->arrayNode('pagination')->addDefaultsIfNotSet()->children(); |
| 327 | 327 | $pagination->integerNode('limit') |
| 328 | - ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
| 328 | + ->defaultValue(100)->info('Maximum limit allowed for all paginations'); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | protected function configurePluginNamespaceGlobalConfig(NodeBuilder $root) |
| 332 | 332 | { |
| 333 | 333 | $namespaces = $root->arrayNode('namespaces') |
| 334 | - ->info( |
|
| 335 | - 'Group GraphQL schema using namespaced schemas. |
|
| 334 | + ->info( |
|
| 335 | + 'Group GraphQL schema using namespaced schemas. |
|
| 336 | 336 | On large schemas is helpful to keep schemas grouped by bundle and node' |
| 337 | - ) |
|
| 338 | - ->canBeEnabled() |
|
| 339 | - ->addDefaultsIfNotSet() |
|
| 340 | - ->children(); |
|
| 337 | + ) |
|
| 338 | + ->canBeEnabled() |
|
| 339 | + ->addDefaultsIfNotSet() |
|
| 340 | + ->children(); |
|
| 341 | 341 | |
| 342 | 342 | $bundles = $namespaces->arrayNode('bundles') |
| 343 | - ->info('Group each bundle into a separate schema definition') |
|
| 344 | - ->canBeDisabled() |
|
| 345 | - ->addDefaultsIfNotSet() |
|
| 346 | - ->children(); |
|
| 343 | + ->info('Group each bundle into a separate schema definition') |
|
| 344 | + ->canBeDisabled() |
|
| 345 | + ->addDefaultsIfNotSet() |
|
| 346 | + ->children(); |
|
| 347 | 347 | |
| 348 | 348 | $bundles->scalarNode('query_suffix') |
| 349 | 349 | ->info('The following suffix will be used for bundle query groups') |
@@ -374,25 +374,25 @@ discard block |
||
| 374 | 374 | ->children(); |
| 375 | 375 | |
| 376 | 376 | $nodes->scalarNode('query_suffix') |
| 377 | - ->info('The following suffix will be used to create the name for queries to the same node') |
|
| 378 | - ->defaultValue('Query'); |
|
| 377 | + ->info('The following suffix will be used to create the name for queries to the same node') |
|
| 378 | + ->defaultValue('Query'); |
|
| 379 | 379 | |
| 380 | 380 | $nodes->scalarNode('mutation_suffix') |
| 381 | - ->info('The following suffix will be used to create the name for mutations to the same node') |
|
| 382 | - ->defaultValue('Mutation'); |
|
| 381 | + ->info('The following suffix will be used to create the name for mutations to the same node') |
|
| 382 | + ->defaultValue('Mutation'); |
|
| 383 | 383 | |
| 384 | 384 | $nodes->variableNode('ignore') |
| 385 | - ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
| 386 | - ->defaultValue(['Node']); |
|
| 385 | + ->info('The following nodes will be ignore for grouping, all definitions will be placed in the root query or mutation') |
|
| 386 | + ->defaultValue(['Node']); |
|
| 387 | 387 | |
| 388 | 388 | $nodes->arrayNode('aliases') |
| 389 | - ->info( |
|
| 390 | - 'Define aliases for nodes to set definitions inside other desired node name. |
|
| 389 | + ->info( |
|
| 390 | + 'Define aliases for nodes to set definitions inside other desired node name. |
|
| 391 | 391 | Can be used to group multiple nodes or publish a node with a different group name' |
| 392 | - ) |
|
| 393 | - ->example('InvoiceItem: Invoice') |
|
| 394 | - ->useAttributeAsKey('name') |
|
| 395 | - ->prototype('scalar'); |
|
| 392 | + ) |
|
| 393 | + ->example('InvoiceItem: Invoice') |
|
| 394 | + ->useAttributeAsKey('name') |
|
| 395 | + ->prototype('scalar'); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | private function configureSecurity(NodeBuilder $rootNode) |
@@ -92,21 +92,21 @@ |
||
| 92 | 92 | if ($config['graphiql']['authentication']['provider']['lexik_jwt']['enabled'] ?? false) { |
| 93 | 93 | $providerName = sprintf('security.user.provider.concrete.%s', $config['graphiql']['authentication']['provider']['lexik_jwt']['user_provider']); |
| 94 | 94 | $container->getDefinition(LexikJWTGraphiQLAuthenticator::class) |
| 95 | - ->setArgument(1, new Reference($providerName)); |
|
| 95 | + ->setArgument(1, new Reference($providerName)); |
|
| 96 | 96 | } else { |
| 97 | 97 | $container->removeDefinition(LexikJWTGraphiQLAuthenticator::class); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | //build the ID encoder manager with configured encoder |
| 101 | 101 | $container->getDefinition(IDEncoderManager::class) |
| 102 | - ->setPublic(true) |
|
| 103 | - ->replaceArgument(0, $container->getDefinition($config['id_encoder'])); |
|
| 102 | + ->setPublic(true) |
|
| 103 | + ->replaceArgument(0, $container->getDefinition($config['id_encoder'])); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | //endpoint definition |
| 107 | 107 | $container->getDefinition(GraphQLEndpointController::class) |
| 108 | - ->addMethodCall('setErrorFormatter', [$container->getDefinition($config['error_handling']['formatter'])]) |
|
| 109 | - ->addMethodCall('setErrorHandler', [$container->getDefinition($config['error_handling']['handler'])]); |
|
| 108 | + ->addMethodCall('setErrorFormatter', [$container->getDefinition($config['error_handling']['formatter'])]) |
|
| 109 | + ->addMethodCall('setErrorHandler', [$container->getDefinition($config['error_handling']['handler'])]); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | $repo = $this->registry->getRepository($class); |
| 79 | 79 | $qb = $repo->createQueryBuilder('o', 'o.id'); |
| 80 | 80 | $entities = $qb->where($qb->expr()->in('o.id', array_values($ids))) |
| 81 | - ->getQuery() |
|
| 82 | - ->getResult(); |
|
| 81 | + ->getQuery() |
|
| 82 | + ->getResult(); |
|
| 83 | 83 | foreach ($entities as $entity) { |
| 84 | 84 | if ($entity instanceof NodeInterface) { |
| 85 | 85 | self::$deferred[$class][$entity->getId()] = $entity; |
@@ -70,10 +70,10 @@ |
||
| 70 | 70 | $paramName = sprintf('%s_ids_%s', $column, mt_rand()); |
| 71 | 71 | if ($condition->getOp() === NodeComparisonOperatorType::IN) { |
| 72 | 72 | $qb->andWhere(sprintf(':%s MEMBER OF %s.%s', $paramName, $alias, $column)) |
| 73 | - ->setParameter($paramName, $ids); |
|
| 73 | + ->setParameter($paramName, $ids); |
|
| 74 | 74 | } else { |
| 75 | 75 | $qb->andWhere(sprintf(':%s NOT MEMBER OF %s.%s', $paramName, $alias, $column)) |
| 76 | - ->setParameter($paramName, $ids); |
|
| 76 | + ->setParameter($paramName, $ids); |
|
| 77 | 77 | } |
| 78 | 78 | break; |
| 79 | 79 | } |
@@ -75,17 +75,17 @@ |
||
| 75 | 75 | |
| 76 | 76 | /** @var NodeBuilder $rootNode */ |
| 77 | 77 | $config->scalarNode('target') |
| 78 | - ->info('Target node to properly paginate. If is possible will be auto-resolved using naming conventions') |
|
| 79 | - ->isRequired(); |
|
| 78 | + ->info('Target node to properly paginate. If is possible will be auto-resolved using naming conventions') |
|
| 79 | + ->isRequired(); |
|
| 80 | 80 | $config->variableNode('filters') |
| 81 | - ->info('Filters configuration'); |
|
| 81 | + ->info('Filters configuration'); |
|
| 82 | 82 | $config->integerNode('limit')->info('Max number of records allowed for first & last')->defaultValue($this->limit); |
| 83 | 83 | $config->scalarNode('parent_field') |
| 84 | - ->info('When is used in sub-fields should be the field to filter by parent instance'); |
|
| 84 | + ->info('When is used in sub-fields should be the field to filter by parent instance'); |
|
| 85 | 85 | $config->enumNode('parent_relation') |
| 86 | - ->info('When is used in sub-fields should be the type of relation with the parent field') |
|
| 87 | - ->defaultValue(self::ONE_TO_MANY) |
|
| 88 | - ->values([self::ONE_TO_MANY, self::MANY_TO_MANY]); |
|
| 86 | + ->info('When is used in sub-fields should be the type of relation with the parent field') |
|
| 87 | + ->defaultValue(self::ONE_TO_MANY) |
|
| 88 | + ->values([self::ONE_TO_MANY, self::MANY_TO_MANY]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |