From 51dd51849620e3fbbc9e7970d7efa8e273494082 Mon Sep 17 00:00:00 2001 From: Benoit Maziere Date: Mon, 5 Aug 2019 16:13:19 +0200 Subject: [PATCH] fix(tree builder): remove deprecation about configuration tree builder without a root node --- CHANGELOG.md | 1 + DependencyInjection/Configuration.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c086d3..4e5e028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,3 +14,4 @@ master * Fix Coveralls tool export * Fix badges * Disable audit of Log (cf. https://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/audit.html) +* Remove deprecation about configuration tree builder without a root node diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 139dda6..20e9379 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -28,8 +28,14 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('ekino_data_protection'); + // Keep compatibility with symfony/config < 4.2 + if (!method_exists(TreeBuilder::class, 'getRootNode')) { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('ekino_data_protection'); + } else { + $treeBuilder = new TreeBuilder('ekino_data_protection'); + $rootNode = $treeBuilder->getRootNode(); + } $rootNode ->children()