diff --git a/src/DependencyInjection/CommandBusConfiguration.php b/src/DependencyInjection/CommandBusConfiguration.php index 464b50f..807f341 100644 --- a/src/DependencyInjection/CommandBusConfiguration.php +++ b/src/DependencyInjection/CommandBusConfiguration.php @@ -18,7 +18,14 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder($this->alias); - $rootNode = $treeBuilder->root($this->alias); + if (method_exists($treeBuilder, 'getRootNode')) { + // Symfony 4.2 + + $rootNode = $treeBuilder->getRootNode(); + } else { + // Symfony 4.1 and below + $rootNode = $treeBuilder->root($this->alias); + } + $rootNode ->addDefaultsIfNotSet() ->children() diff --git a/src/DependencyInjection/DoctrineOrmBridgeConfiguration.php b/src/DependencyInjection/DoctrineOrmBridgeConfiguration.php index 8750bbf..ee43d99 100644 --- a/src/DependencyInjection/DoctrineOrmBridgeConfiguration.php +++ b/src/DependencyInjection/DoctrineOrmBridgeConfiguration.php @@ -18,7 +18,13 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder($this->alias); - $rootNode = $treeBuilder->root($this->alias); + if (method_exists($treeBuilder, 'getRootNode')) { + // Symfony 4.2 + + $rootNode = $treeBuilder->getRootNode(); + } else { + // Symfony 4.1 and below + $rootNode = $treeBuilder->root($this->alias); + } $rootNode ->addDefaultsIfNotSet() diff --git a/src/DependencyInjection/EventBusConfiguration.php b/src/DependencyInjection/EventBusConfiguration.php index 985cd22..4791142 100644 --- a/src/DependencyInjection/EventBusConfiguration.php +++ b/src/DependencyInjection/EventBusConfiguration.php @@ -18,7 +18,14 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder($this->alias); - $rootNode = $treeBuilder->root($this->alias); + if (method_exists($treeBuilder, 'getRootNode')) { + // Symfony 4.2 + + $rootNode = $treeBuilder->getRootNode(); + } else { + // Symfony 4.1 and below + $rootNode = $treeBuilder->root($this->alias); + } + $rootNode ->addDefaultsIfNotSet() ->children()