Skip to content

Commit

Permalink
Create TreeBuilder with root defined. (#44)
Browse files Browse the repository at this point in the history
* Create TreeBuilder with root defined.

Fix for 'A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.'

* Add support for symfony < 4.2

The BC layer is taken from KnpLabs/KnpPaginatorBundle@740b876#diff-850942b3ba24ab03a40aaa81b6152852
  • Loading branch information
Mondane authored and rvanlaak committed May 15, 2019
1 parent e294028 commit 1751b89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('apy_breadcrumb_trail');
$treeBuilder = new TreeBuilder('apy_breadcrumb_trail');
// BC layer for symfony/config < 4.2
$rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('apy_breadcrumb_trail');

$rootNode
->children()
Expand Down

0 comments on commit 1751b89

Please sign in to comment.