]> Raphaƫl G. Git Repositories - userbundle/blobdiff - DependencyInjection/Configuration.php
Move configuration under rapsys_user key
[userbundle] / DependencyInjection / Configuration.php
index 14066d194b5564470e7b85a14e91103d2adf07b6..b02524c48424c4de44d61c17f3925dd513b434e9 100644 (file)
@@ -16,7 +16,7 @@ class Configuration implements ConfigurationInterface {
         */
        public function getConfigTreeBuilder() {
                //Set tree builder
         */
        public function getConfigTreeBuilder() {
                //Set tree builder
-               $treeBuilder = new TreeBuilder();
+               $treeBuilder = new TreeBuilder('rapsys_user');
 
                //The bundle default values
                $defaults = [
 
                //The bundle default values
                $defaults = [
@@ -83,122 +83,111 @@ class Configuration implements ConfigurationInterface {
                //Here we define the parameters that are allowed to configure the bundle.
                $treeBuilder
                        //Parameters
                //Here we define the parameters that are allowed to configure the bundle.
                $treeBuilder
                        //Parameters
-                       ->root('parameters')
+                       ->getRootNode()
                                ->addDefaultsIfNotSet()
                                ->children()
                                ->addDefaultsIfNotSet()
                                ->children()
-                                       ->arrayNode('rapsys_user')
+                                       ->arrayNode('class')
                                                ->addDefaultsIfNotSet()
                                                ->children()
                                                ->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()
                                                        ->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()
                                                        ->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()
                                                        ->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()
                                                        ->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()
                                                        ->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()
                                                        ->end()
                                                ->end()
                                        ->end()