Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Fix deprecation for symfony/config 4.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu authored and OskarStark committed Dec 17, 2018
1 parent 807d2c0 commit 46e7b6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sonata_news');
$treeBuilder = new TreeBuilder('sonata_news');

// Keep compatibility with symfony/config < 4.2
if (!\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('sonata_news');
} else {
$rootNode = $treeBuilder->getRootNode();
}

$rootNode
->children()
Expand Down

0 comments on commit 46e7b6e

Please sign in to comment.