X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/a15c67f3328e55845e53257618a4d5ad612e4e05..e7d0d2eda30f445cd06cffdc6d4932e1da123f00:/DependencyInjection/Configuration.php 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()