From 9b4ee0f61a50727fec7831aec3b485fdcb8115fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Thu, 7 Nov 2019 03:48:25 +0100 Subject: [PATCH] Move configuration under rapsys_user key --- DependencyInjection/Configuration.php | 203 ++++++++++++-------------- 1 file changed, 96 insertions(+), 107 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 5ef8718..b02524c 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -16,7 +16,7 @@ class Configuration implements ConfigurationInterface { */ public function getConfigTreeBuilder() { //Set tree builder - $treeBuilder = new TreeBuilder('parameters'); + $treeBuilder = new TreeBuilder('rapsys_user'); //The bundle default values $defaults = [ @@ -86,119 +86,108 @@ class Configuration implements ConfigurationInterface { ->getRootNode() ->addDefaultsIfNotSet() ->children() - ->arrayNode('rapsys_user') + ->arrayNode('class') ->addDefaultsIfNotSet() ->children() - ->arrayNode('class') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('group')->isRequired()->defaultValue($defaults['class']['group'])->end() - ->scalarNode('title')->isRequired()->defaultValue($defaults['class']['title'])->end() - ->scalarNode('user')->isRequired()->defaultValue($defaults['class']['user'])->end() - ->end() + ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end() + ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['class']['title'])->end() + ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end() + ->end() + ->end() + ->arrayNode('contact') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end() + ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end() + ->scalarNode('home_name')->cannotBeEmpty()->defaultValue($defaults['contact']['home_name'])->end() + ->arrayNode('home_args') + ->cannotBeEmpty() + ->treatNullLike($defaults['contact']['home_args']) + ->defaultValue($defaults['contact']['home_args']) + ->scalarPrototype()->end() + ->end() + ->end() + ->end() + ->arrayNode('login') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['login']['template'])->end() + ->arrayNode('context') + ->cannotBeEmpty() + ->treatNullLike(array()) + ->defaultValue($defaults['login']['context']) + ->scalarPrototype()->end() + ->end() + ->end() + ->end() + ->arrayNode('register') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['register']['mail_template'])->end() + ->arrayNode('mail_context') + ->cannotBeEmpty() + ->treatNullLike($defaults['register']['mail_context']) + ->defaultValue($defaults['register']['mail_context']) + ->scalarPrototype()->end() + ->end() + ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['register']['template'])->end() + ->arrayNode('context') + ->cannotBeEmpty() + ->treatNullLike($defaults['register']['context']) + ->defaultValue($defaults['register']['context']) + ->scalarPrototype()->end() + ->end() + ->end() + ->end() + ->arrayNode('recover') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end() + ->arrayNode('mail_context') + ->cannotBeEmpty() + ->treatNullLike($defaults['recover']['mail_context']) + ->defaultValue($defaults['recover']['mail_context']) + ->scalarPrototype()->end() ->end() - ->arrayNode('contact') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('name')->isRequired()->defaultValue($defaults['contact']['name'])->end() - ->scalarNode('mail')->isRequired()->defaultValue($defaults['contact']['mail'])->end() - ->scalarNode('home_name')->isRequired()->defaultValue($defaults['contact']['home_name'])->end() - ->arrayNode('home_args') - ->isRequired() - ->treatNullLike($defaults['contact']['home_args']) - ->defaultValue($defaults['contact']['home_args']) - ->scalarPrototype()->end() - ->end() - ->end() + ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end() + ->arrayNode('url_args') + ->cannotBeEmpty() + ->treatNullLike($defaults['recover']['url_args']) + ->defaultValue($defaults['recover']['url_args']) + ->scalarPrototype()->end() ->end() - ->arrayNode('login') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('template')->isRequired()->defaultValue($defaults['login']['template'])->end() - ->arrayNode('context') - ->isRequired() - ->treatNullLike(array()) - ->defaultValue($defaults['login']['context']) - ->scalarPrototype()->end() - ->end() - ->end() + ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end() + ->arrayNode('context') + ->cannotBeEmpty() + ->treatNullLike(array()) + ->defaultValue($defaults['recover']['context']) + ->scalarPrototype()->end() ->end() - ->arrayNode('register') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['register']['mail_template'])->end() - ->arrayNode('mail_context') - ->isRequired() - ->treatNullLike($defaults['register']['mail_context']) - ->defaultValue($defaults['register']['mail_context']) - ->scalarPrototype()->end() - ->end() - ->scalarNode('template')->isRequired()->defaultValue($defaults['register']['template'])->end() - ->arrayNode('context') - ->isRequired() - ->treatNullLike($defaults['register']['context']) - ->defaultValue($defaults['register']['context']) - ->scalarPrototype()->end() - ->end() - ->end() + ->end() + ->end() + ->arrayNode('recover_mail') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('mail_template')->cannotBeEmpty()->defaultValue($defaults['recover']['mail_template'])->end() + ->arrayNode('mail_context') + ->cannotBeEmpty() + ->treatNullLike($defaults['recover']['mail_context']) + ->defaultValue($defaults['recover']['mail_context']) + ->scalarPrototype()->end() ->end() - ->arrayNode('recover') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end() - ->arrayNode('mail_context') - ->isRequired() - ->treatNullLike($defaults['recover']['mail_context']) - ->defaultValue($defaults['recover']['mail_context']) - ->scalarPrototype()->end() - ->end() - ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end() - ->arrayNode('url_args') - ->isRequired() - ->treatNullLike($defaults['recover']['url_args']) - ->defaultValue($defaults['recover']['url_args']) - ->scalarPrototype()->end() - ->end() - ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end() - ->arrayNode('context') - ->isRequired() - ->treatNullLike(array()) - ->defaultValue($defaults['recover']['context']) - ->scalarPrototype()->end() - ->end() - ->end() + ->scalarNode('url_name')->cannotBeEmpty()->defaultValue($defaults['recover']['url_name'])->end() + ->arrayNode('url_args') + ->cannotBeEmpty() + ->treatNullLike($defaults['recover']['url_args']) + ->defaultValue($defaults['recover']['url_args']) + ->scalarPrototype()->end() ->end() - ->arrayNode('recover_mail') - ->isRequired() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('mail_template')->isRequired()->defaultValue($defaults['recover']['mail_template'])->end() - ->arrayNode('mail_context') - ->isRequired() - ->treatNullLike($defaults['recover']['mail_context']) - ->defaultValue($defaults['recover']['mail_context']) - ->scalarPrototype()->end() - ->end() - ->scalarNode('url_name')->isRequired()->defaultValue($defaults['recover']['url_name'])->end() - ->arrayNode('url_args') - ->isRequired() - ->treatNullLike($defaults['recover']['url_args']) - ->defaultValue($defaults['recover']['url_args']) - ->scalarPrototype()->end() - ->end() - ->scalarNode('template')->isRequired()->defaultValue($defaults['recover']['template'])->end() - ->arrayNode('context') - ->isRequired() - ->treatNullLike(array()) - ->defaultValue($defaults['recover']['context']) - ->scalarPrototype()->end() - ->end() - ->end() + ->scalarNode('template')->cannotBeEmpty()->defaultValue($defaults['recover']['template'])->end() + ->arrayNode('context') + ->cannotBeEmpty() + ->treatNullLike(array()) + ->defaultValue($defaults['recover']['context']) + ->scalarPrototype()->end() ->end() ->end() ->end() -- 2.41.1