Skip to content

Commit

Permalink
Merge pull request #8 from peter-gribanov/symfony_5
Browse files Browse the repository at this point in the history
Add fix for Symfony >4.2 in Configuration
  • Loading branch information
peter-gribanov authored Aug 14, 2019
2 parents d095823 + b349796 commit d2b5e43
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$builder = new TreeBuilder();
$builder->root('gpslab_pagination')
$tree_builder = new TreeBuilder('gpslab_pagination');

if (method_exists($tree_builder, 'getRootNode')) {
// Symfony 4.2 +
$root = $tree_builder->getRootNode();
} else {
// Symfony 4.1 and below
$root = $tree_builder->root('gpslab_pagination');
}

$root
->addDefaultsIfNotSet()
->children()
->scalarNode('max_navigate')
Expand All @@ -34,6 +43,6 @@ public function getConfigTreeBuilder()
->end()
->end();

return $builder;
return $tree_builder;
}
}

0 comments on commit d2b5e43

Please sign in to comment.