Skip to content

Commit

Permalink
Updates configuration.php deprecated rootnode
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhoyt authored Feb 4, 2021
1 parent d57f2eb commit 255010c
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('uecode_qpush');

$treeBuilder = new TreeBuilder('uecode_qpush');
if (\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('uecode_qpush');
}

$rootNode
->addDefaultsIfNotSet()
->children()
Expand All @@ -54,8 +59,14 @@ public function getConfigTreeBuilder()

private function getProvidersNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('providers');
$treeBuilder = new TreeBuilder('providers');
if (\method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$node = $treeBuilder->root('providers');
}

$requirements = [
'aws' => [],
'ironmq' => ['token', 'project_id'],
Expand Down Expand Up @@ -126,9 +137,14 @@ private function getProvidersNode()

private function getQueuesNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('queues');

$treeBuilder = new TreeBuilder('queues');
if (\method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$node = $treeBuilder->root('queues');
}

$node
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
Expand Down Expand Up @@ -213,9 +229,14 @@ private function getQueuesNode()

private function getSubscribersNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('subscribers');

$treeBuilder = new TreeBuilder('subscribers');
if (\method_exists($treeBuilder, 'getRootNode')) {
$node = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$node = $treeBuilder->root('subscribers');
}

$node
->prototype('array')
->children()
Expand Down

0 comments on commit 255010c

Please sign in to comment.