]> Raphaƫl G. Git Repositories - userbundle/blobdiff - DependencyInjection/Configuration.php
Remove cannotBeEmpty() requirement on empty keys
[userbundle] / DependencyInjection / Configuration.php
index 5ef87180a7fa221d328675c2116c91582f1da3b6..f261fc0a5a8893cd00227ed89e66ca0d3f892881 100644 (file)
@@ -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,101 @@ 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')
+                                                               ->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')
+                                                               ->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')
+                                                               ->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')
+                                                               ->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')
+                                                               ->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')
+                                                               ->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')
+                                                               ->treatNullLike(array())
+                                                               ->defaultValue($defaults['recover']['context'])
+                                                               ->scalarPrototype()->end()
                                                        ->end()
                                                ->end()
                                        ->end()