From: Raphaƫl Gertz Date: Thu, 29 Feb 2024 13:23:50 +0000 (+0100) Subject: Readd languages and locale in default key X-Git-Tag: 0.4.0~25 X-Git-Url: https://git.rapsys.eu/userbundle/commitdiff_plain/edaded281e162f8aa78b6b329b3c9cec8fe176c0?ds=sidebyside Readd languages and locale in default key Prevent ignore extra keys removing extra keys --- diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index ffe1d14..208bf98 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -41,6 +41,10 @@ class Configuration implements ConfigurationInterface { 'default' => [ 'admin' => 'ROLE_ADMIN', 'civility' => 'Mister', + 'languages' => [ + 'en_gb' => 'English' + ], + 'locales' => [ 'en_gb' ], 'group' => [ 'User' ] ], 'route' => [ @@ -150,7 +154,8 @@ class Configuration implements ConfigurationInterface { ->children() ->arrayNode('class') ->addDefaultsIfNotSet() - ->ignoreExtraKeys() + #XXX: ignoreExtraKeys(bool $remove = true) + ->ignoreExtraKeys(false) ->children() ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['class']['civility'])->end() ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end() @@ -159,10 +164,23 @@ class Configuration implements ConfigurationInterface { ->end() ->arrayNode('default') ->addDefaultsIfNotSet() - ->ignoreExtraKeys() + #XXX: ignoreExtraKeys(bool $remove = true) + ->ignoreExtraKeys(false) ->children() ->scalarNode('admin')->cannotBeEmpty()->defaultValue($defaults['default']['admin'])->end() ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['default']['civility'])->end() + #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false) + ->arrayNode('languages') + ->treatNullLike([]) + ->defaultValue($defaults['default']['languages']) + ->scalarPrototype()->end() + ->end() + #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false) + ->arrayNode('locales') + ->treatNullLike([]) + ->defaultValue($defaults['default']['locales']) + ->scalarPrototype()->end() + ->end() ->arrayNode('group') ->treatNullLike([]) ->defaultValue($defaults['default']['group'])