Skip to content

Commit

Permalink
fixed : rootNode for configuration of the TreeBuilder
Browse files Browse the repository at this point in the history
I applied the basic and well-known trick for this part :
check if the new method getRootNode() exist and got for the old root() method for compatibility.
  • Loading branch information
encreinformatique authored and pkruithof committed Nov 28, 2022
1 parent d84923c commit e18ff11
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@
*/
class Configuration implements ConfigurationInterface
{
const ROOT_NAME = 'fos_message';

/**
* Generates the configuration tree.
*
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('fos_message');
$rootNode = $treeBuilder->root('fos_message');
$treeBuilder = new TreeBuilder(self::ROOT_NAME);
if (\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
$rootNode = $treeBuilder->root(self::ROOT_NAME);
}

$rootNode
->children()
Expand Down

0 comments on commit e18ff11

Please sign in to comment.