Skip to content

Commit e70b386

Browse files
committed
Deprecate all configuration
1 parent df042f0 commit e70b386

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

DependencyInjection/Configuration.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
namespace Yokai\EnumBundle\DependencyInjection;
44

5+
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
56
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
67
use Symfony\Component\Config\Definition\ConfigurationInterface;
8+
use Symfony\Component\HttpKernel\Kernel;
79

810
/**
911
* @author Yann Eugoné <[email protected]>
@@ -15,8 +17,13 @@ class Configuration implements ConfigurationInterface
1517
*/
1618
public function getConfigTreeBuilder()
1719
{
18-
$treeBuilder = new TreeBuilder();
19-
$rootNode = $treeBuilder->root('yokai_enum');
20+
if (version_compare(Kernel::VERSION, '4.2') >= 0) {
21+
$treeBuilder = new TreeBuilder('presta_sitemap');
22+
$rootNode = $treeBuilder->getRootNode();
23+
} else {
24+
$treeBuilder = new TreeBuilder();
25+
$rootNode = $treeBuilder->root('presta_sitemap');
26+
}
2027

2128
$rootNode
2229
->children()
@@ -25,11 +32,11 @@ public function getConfigTreeBuilder()
2532
->defaultFalse()
2633
->end()
2734
->booleanNode('enum_autoconfiguration')
28-
->info('If set to true, all services that implements EnumInterface, will obtain the "enum" tag automatically.')
35+
->info('[DEPRECATED] If set to true, all services that implements EnumInterface, will obtain the "enum" tag automatically.')
2936
->defaultTrue()
3037
->end()
3138
->booleanNode('enum_registry_autoconfigurable')
32-
->info('If set to true, add an alias for the enum registry so your service can ask for it via autoconfiguration.')
39+
->info('[DEPRECATED] If set to true, add an alias for the enum registry so your service can ask for it via autoconfiguration.')
3340
->defaultTrue()
3441
->end()
3542
->end()

DependencyInjection/EnumExtension.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public function load(array $configs, ContainerBuilder $container)
2222
$configuration = new Configuration();
2323
$config = $this->processConfiguration($configuration, $configs);
2424

25+
if ($config['register_bundles']) {
26+
@trigger_error('"register_bundles" config var with value "true" is deprecated since v2.3 and will be removed in v3.0', \E_USER_DEPRECATED);
27+
}
28+
if (!$config['enum_autoconfiguration']) {
29+
@trigger_error('"enum_autoconfiguration" config var with value "false" is deprecated since v2.3 and will be removed in v3.0', \E_USER_DEPRECATED);
30+
}
31+
if ($config['enum_registry_autoconfigurable']) {
32+
@trigger_error('"enum_registry_autoconfigurable" config var with value "false" is deprecated since v2.3 and will be removed in v3.0', \E_USER_DEPRECATED);
33+
}
34+
2535
$container->setParameter('enum.register_bundles', $config['register_bundles']);
2636

2737
$xmlLoader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

0 commit comments

Comments
 (0)