]> Raphaël G. Git Repositories - userbundle/commitdiff
Add default title and group
authorRaphaël Gertz <git@rapsys.eu>
Mon, 7 Dec 2020 22:56:05 +0000 (23:56 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 7 Dec 2020 23:00:05 +0000 (00:00 +0100)
DependencyInjection/Configuration.php

index a8c03248741ea3171636e2c41ee63606f14a76c8..63ba75f5c9cc4966bf6dce917c211b781b2a3028 100644 (file)
@@ -20,11 +20,15 @@ class Configuration implements ConfigurationInterface {
 
                //The bundle default values
                $defaults = [
-                       'class' => [
+                       'class' => [
                                'group' => 'Rapsys\\UserBundle\\Entity\\Group',
                                'title' => 'Rapsys\\UserBundle\\Entity\\Title',
                                'user' => 'Rapsys\\UserBundle\\Entity\\User'
                        ],
+                       'default' => [
+                               'title' => 'Mister',
+                               'group' => [ 'User' ]
+                       ],
                        'route' => [
                                'index' => [
                                        'name' => 'rapsys_user_index',
@@ -123,6 +127,17 @@ class Configuration implements ConfigurationInterface {
                                                        ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
                                                ->end()
                                        ->end()
+                                       ->arrayNode('default')
+                                               ->addDefaultsIfNotSet()
+                                               ->children()
+                                                       ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['default']['title'])->end()
+                                                       ->arrayNode('group')
+                                                               ->treatNullLike(array())
+                                                               ->defaultValue($defaults['default']['group'])
+                                                               ->scalarPrototype()->end()
+                                                       ->end()
+                                               ->end()
+                                       ->end()
                                        ->arrayNode('route')
                                                ->addDefaultsIfNotSet()
                                                ->children()