Skip to content

Commit 8a0c8b4

Browse files
authored
GraphiQL and React version can be manage using semantic config. (#52)
1 parent da3366d commit 8a0c8b4

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

Controller/GraphiQLController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function indexAction()
2424
'versions' => [
2525
'graphiql' => $this->getParameter('overblog_graphql.versions.graphiql'),
2626
'react' => $this->getParameter('overblog_graphql.versions.react'),
27-
]
27+
],
2828
]
2929
);
3030
}

DependencyInjection/Configuration.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,16 @@ public function getConfigTreeBuilder()
110110
->end()
111111
->arrayNode('security')
112112
->addDefaultsIfNotSet()
113-
->children()
114-
->append($this->addSecurityQuerySection('query_max_depth', QueryDepth::DISABLED))
115-
->append($this->addSecurityQuerySection('query_max_complexity', QueryComplexity::DISABLED))
116-
->end()
113+
->children()
114+
->append($this->addSecurityQuerySection('query_max_depth', QueryDepth::DISABLED))
115+
->append($this->addSecurityQuerySection('query_max_complexity', QueryComplexity::DISABLED))
116+
->end()
117+
->end()
118+
->arrayNode('versions')
119+
->addDefaultsIfNotSet()
120+
->children()
121+
->scalarNode('graphiql')->defaultValue('0.7.1')->end()
122+
->scalarNode('react')->defaultValue('15.0.2')->end()
117123
->end()
118124
->end()
119125
->end();

DependencyInjection/OverblogGraphQLExtension.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function load(array $configs, ContainerBuilder $container)
3636
$this->setGraphiQLTemplate($config, $container);
3737
$this->setSecurity($config, $container);
3838
$this->setConfigBuilders($config);
39+
$this->setVersions($config, $container);
3940

4041
$container->setParameter($this->getAlias().'.resources_dir', realpath(__DIR__.'/../Resources'));
4142
}
@@ -51,6 +52,12 @@ public function prepend(ContainerBuilder $container)
5152
$typesExtension->containerPrependExtensionConfig($config, $container);
5253
}
5354

55+
private function setVersions(array $config, ContainerBuilder $container)
56+
{
57+
$container->setParameter($this->getAlias().'.versions.graphiql', $config['versions']['graphiql']);
58+
$container->setParameter($this->getAlias().'.versions.react', $config['versions']['react']);
59+
}
60+
5461
private function setConfigBuilders(array $config)
5562
{
5663
foreach (['args', 'field'] as $category) {

Resources/config/services.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
parameters:
22
overblog_graphql.default_resolver: [Overblog\GraphQLBundle\Resolver\Resolver, defaultResolveFn]
33
overblog_graphql.type_class_namespace: "Overblog\\GraphQLBundle\\__DEFINITIONS__"
4-
overblog_graphql.versions.graphiql: "0.7.1"
5-
overblog_graphql.versions.react: "15.0.2"
64

75
services:
86
overblog_graphql.error_handler:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/framework-bundle": "^2.7|^3.0",
3030
"symfony/options-resolver": "^2.7|^3.0",
3131
"symfony/property-access": "^2.7|^3.0",
32-
"webonyx/graphql-php": "0.6.2"
32+
"webonyx/graphql-php": "0.6.4"
3333
},
3434
"suggest": {
3535
"twig/twig": "If you want to use graphiQL."

0 commit comments

Comments
 (0)