diff --git a/Command/GraphQLConfigureCommand.php b/Command/GraphQLConfigureCommand.php
index ee6c492..625e858 100644
--- a/Command/GraphQLConfigureCommand.php
+++ b/Command/GraphQLConfigureCommand.php
@@ -5,14 +5,24 @@
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Config\Resource\FileResource;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
+use Symfony\Component\Routing\Router;
-class GraphQLConfigureCommand extends ContainerAwareCommand
+class GraphQLConfigureCommand extends Command
{
const PROJECT_NAMESPACE = 'App';
+ private $router;
+
+ public function __construct(Router $router)
+ {
+ parent::__construct();
+ $this->router = $router;
+ }
+
/**
* {@inheritdoc}
*/
@@ -32,7 +42,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$isComposerCall = $input->getOption('composer');
$container = $this->getContainer();
- $rootDir = $container->getParameter('kernel.root_dir');
+ $rootDir = $container->getParameter('kernel.project_dir');
$configFile = $rootDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config/packages/graphql.yml';
$className = 'Schema';
@@ -105,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
*/
protected function getMainRouteConfig()
{
- $routerResources = $this->getContainer()->get('router')->getRouteCollection()->getResources();
+ $routerResources = $this->router->getRouteCollection()->getResources();
foreach ($routerResources as $resource) {
/** @var FileResource|DirectoryResource $resource */
if (method_exists($resource, 'getResource') && substr($resource->getResource(), -11) == 'routes.yaml') {
@@ -122,7 +132,7 @@ protected function getMainRouteConfig()
*/
protected function graphQLRouteExists()
{
- $routerResources = $this->getContainer()->get('router')->getRouteCollection()->getResources();
+ $routerResources = $this->router->getRouteCollection()->getResources();
foreach ($routerResources as $resource) {
/** @var FileResource|DirectoryResource $resource */
if (method_exists($resource, 'getResource') && strpos($resource->getResource(), 'GraphQLController.php') !== false) {
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index f8876d6..57c6917 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -18,8 +18,8 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
- $treeBuilder = new TreeBuilder();
- $rootNode = $treeBuilder->root('graphql');
+ $treeBuilder = new TreeBuilder('graphql');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/Resources/config/route.xml b/Resources/config/route.xml
index d478b84..6e46d79 100644
--- a/Resources/config/route.xml
+++ b/Resources/config/route.xml
@@ -5,7 +5,7 @@
http://symfony.com/schema/routing/routing-1.0.xsd">
- GraphQLBundle:GraphQL:default
+ Youshido\GraphQLBundle\Controller\GraphQLController::defaultAction
diff --git a/composer.json b/composer.json
index acf3f24..dad1a1f 100644
--- a/composer.json
+++ b/composer.json
@@ -24,6 +24,6 @@
"require-dev": {
"phpunit/phpunit": "~4.7",
"composer/composer": "~1.2",
- "symfony/framework-bundle": "~2.7|~3.0"
+ "symfony/framework-bundle": "~2.7|~3.0|~4.0|~5.0"
}
}