Skip to content

Commit

Permalink
Fix deprecation for symfony/config 4.2+ (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu authored and kunicmarko20 committed Dec 16, 2018
1 parent 4028dd6 commit abf293b
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 @@ -31,8 +31,14 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sonata_doctrine_mongo_db_admin', 'array');
$treeBuilder = new TreeBuilder('sonata_doctrine_mongo_db_admin');

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

$rootNode
->children()
Expand Down

0 comments on commit abf293b

Please sign in to comment.