Skip to content

Commit

Permalink
Merge pull request #4 from thomascrepain/symfony-5
Browse files Browse the repository at this point in the history
Symfony 5 compatibility
  • Loading branch information
danaki authored Apr 20, 2020
2 parents 121a9c2 + dd17bf8 commit 2185d19
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('doctrine_enum_type')
->children()
$treeBuilder = new TreeBuilder('doctrine_enum_type');

if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('doctrine_enum_type');
}

$rootNode->children()
->arrayNode('types')
->useAttributeAsKey('name')
->prototype('scalar')->end()
Expand Down

0 comments on commit 2185d19

Please sign in to comment.