Merge pull request #200 from adamwojs/fix_deprecated_tree_builder_root_call

Fixed deprecated TreeBuilder::root method call in SF 4
This commit is contained in:
Grégoire Passault 2019-09-23 15:07:46 +02:00 committed by GitHub
commit 3ccfdf1c93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -14,8 +14,14 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('gregwar_captcha');
$treeBuilder = new TreeBuilder('gregwar_captcha');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC for symfony/config <= 4.1
$rootNode = $treeBuilder->root('gregwar_captcha');
}
$rootNode
->addDefaultsIfNotSet()