1 <?php 
declare(strict_types
=1); 
   4  * This file is part of the Rapsys PackBundle package. 
   6  * (c) Raphaël Gertz <symfony@rapsys.eu> 
   8  * For the full copyright and license information, please view the LICENSE 
   9  * file that was distributed with this source code. 
  12 namespace Rapsys\UserBundle\DependencyInjection
; 
  14 use Symfony\Component\Config\Definition\Builder\TreeBuilder
; 
  15 use Symfony\Component\Config\Definition\ConfigurationInterface
; 
  18  * This is the class that validates and merges configuration from your app/config files. 
  20  * @link http://symfony.com/doc/current/cookbook/bundles/configuration.html} 
  24 class Configuration 
implements ConfigurationInterface 
{ 
  28         public function getConfigTreeBuilder(): TreeBuilder 
{ 
  30                 $treeBuilder = new TreeBuilder('rapsys_user'); 
  32                 //The bundle default values 
  35                                 'group' => 'Rapsys\\UserBundle\\Entity\\Group', 
  36                                 'civility' => 'Rapsys\\UserBundle\\Entity\\Civility', 
  37                                 'user' => 'Rapsys\\UserBundle\\Entity\\User' 
  40                                 'civility' => 'Mister', 
  45                                         'name' => 'rapsys_user_confirm', 
  49                                         'name' => 'rapsys_user_edit', 
  53                                         'name' => 'rapsys_user_index', 
  57                                         'name' => 'rapsys_user_login', 
  61                                         'name' => 'rapsys_user_recover', 
  65                                         'name' => 'rapsys_user_register', 
  70                         'locales' => '%kernel.translator.fallbacks%', 
  75                                 'title' => 'John Doe', 
  76                                 'mail' => 'contact@example.com' 
  80                                 'route' => ['index' => 'index_url'], 
  82                                         'form' => 'Rapsys\UserBundle\Form\RegisterType', 
  83                                         'name' => '@RapsysUser/form/register.html.twig', 
  88                                 'route' => ['index' => 'index_url'], 
  90                                         'name' => '@RapsysUser/form/login.html.twig', 
  91                                         'form' => 'Rapsys\UserBundle\Form\LoginType', 
  96                                 'route' => ['index' => 'index_url', 'recover' => 'recover_url'], 
  98                                         'name' => '@RapsysUser/form/recover.html.twig', 
  99                                         'form' => 'Rapsys\UserBundle\Form\RecoverType', 
 103                                         'subject' => 'Welcome back!', 
 104                                         'html' => '@RapsysUser/mail/recover.html.twig', 
 105                                         'text' => '@RapsysUser/mail/recover.text.twig', 
 110                                 'route' => ['index' => 'index_url', 'confirm' => 'confirm_url'], 
 112                                         'form' => 'Rapsys\UserBundle\Form\RegisterType', 
 113                                         'name' => '@RapsysUser/form/register.html.twig', 
 117                                         'subject' => 'Welcome!', 
 118                                         'html' => '@RapsysUser/mail/register.html.twig', 
 119                                         'text' => '@RapsysUser/mail/register.text.twig', 
 126                  * Defines parameters allowed to configure the bundle 
 128                  * @link https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php 
 129                  * @link http://symfony.com/doc/current/components/config/definition.html 
 130                  * @link https://github.com/symfony/assetic-bundle/blob/master/DependencyInjection/Configuration.php#L63 
 132                  * @see php bin/console config:dump-reference rapsys_user to dump default config 
 133                  * @see php bin/console debug:config rapsys_user to dump config 
 138                                 ->addDefaultsIfNotSet() 
 142                                                 ->defaultValue($defaults['class']) 
 143                                                 ->scalarPrototype()->end() 
 145                                         ->arrayNode('default') 
 146                                                 ->addDefaultsIfNotSet() 
 148                                                         ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['default']['civility'])->end() 
 151                                                                 ->defaultValue($defaults['default']['group']) 
 152                                                                 ->scalarPrototype()->end() 
 157                                                 ->addDefaultsIfNotSet() 
 159                                                         ->arrayNode('confirm') 
 160                                                                 ->addDefaultsIfNotSet() 
 162                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['confirm']['name'])->end() 
 163                                                                         ->arrayNode('context') 
 165                                                                                 ->defaultValue($defaults['route']['confirm']['context']) 
 166                                                                                 ->scalarPrototype()->end() 
 171                                                                 ->addDefaultsIfNotSet() 
 173                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['index']['name'])->end() 
 174                                                                         ->arrayNode('context') 
 176                                                                                 ->defaultValue($defaults['route']['index']['context']) 
 177                                                                                 ->scalarPrototype()->end() 
 182                                                                 ->addDefaultsIfNotSet() 
 184                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['edit']['name'])->end() 
 185                                                                         ->arrayNode('context') 
 187                                                                                 ->defaultValue($defaults['route']['edit']['context']) 
 188                                                                                 ->scalarPrototype()->end() 
 193                                                                 ->addDefaultsIfNotSet() 
 195                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['login']['name'])->end() 
 196                                                                         ->arrayNode('context') 
 198                                                                                 ->defaultValue($defaults['route']['login']['context']) 
 199                                                                                 ->scalarPrototype()->end() 
 203                                                         ->arrayNode('recover') 
 204                                                                 ->addDefaultsIfNotSet() 
 206                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover']['name'])->end() 
 207                                                                         ->arrayNode('context') 
 209                                                                                 ->defaultValue($defaults['route']['recover']['context']) 
 210                                                                                 ->scalarPrototype()->end() 
 214                                                         ->arrayNode('register') 
 215                                                                 ->addDefaultsIfNotSet() 
 217                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['register']['name'])->end() 
 218                                                                         ->arrayNode('context') 
 220                                                                                 ->defaultValue($defaults['route']['register']['context']) 
 221                                                                                 ->scalarPrototype()->end() 
 227                                         ->arrayNode('translate') 
 229                                                 ->defaultValue($defaults['translate']) 
 230                                                 ->scalarPrototype()->end() 
 232                                         ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end() 
 233                                         ->arrayNode('languages') 
 235                                                 ->defaultValue($defaults['languages']) 
 236                                                 ->scalarPrototype()->end() 
 238                                         ->arrayNode('contact') 
 239                                                 ->addDefaultsIfNotSet() 
 241                                                         ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['contact']['title'])->end() 
 242                                                         ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end() 
 245                                         ->arrayNode('context') 
 247                                                 ->defaultValue($defaults['context']) 
 248                                                 ->variablePrototype()->end() 
 251                                                 ->addDefaultsIfNotSet() 
 255                                                                 ->defaultValue($defaults['edit']['route']) 
 256                                                                 ->scalarPrototype()->end() 
 259                                                                 ->addDefaultsIfNotSet() 
 261                                                                         ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['form'])->end() 
 262                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['edit']['view']['name'])->end() 
 263                                                                         ->arrayNode('context') 
 265                                                                                 ->defaultValue($defaults['edit']['view']['context']) 
 266                                                                                 ->variablePrototype()->end() 
 273                                                 ->addDefaultsIfNotSet() 
 277                                                                 ->defaultValue($defaults['login']['route']) 
 278                                                                 ->scalarPrototype()->end() 
 281                                                                 ->addDefaultsIfNotSet() 
 283                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['login']['view']['name'])->end() 
 284                                                                         ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['login']['view']['form'])->end() 
 285                                                                         ->arrayNode('context') 
 287                                                                                 ->defaultValue($defaults['login']['view']['context']) 
 288                                                                                 ->variablePrototype()->end() 
 294                                         ->arrayNode('recover') 
 295                                                 ->addDefaultsIfNotSet() 
 299                                                                 ->defaultValue($defaults['recover']['route']) 
 300                                                                 ->scalarPrototype()->end() 
 303                                                                 ->addDefaultsIfNotSet() 
 305                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['name'])->end() 
 306                                                                         ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['form'])->end() 
 307                                                                         ->arrayNode('context') 
 309                                                                                 ->defaultValue($defaults['recover']['view']['context']) 
 310                                                                                 ->variablePrototype()->end() 
 315                                                                 ->addDefaultsIfNotSet() 
 317                                                                         ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['subject'])->end() 
 318                                                                         ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['html'])->end() 
 319                                                                         ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['text'])->end() 
 320                                                                         ->arrayNode('context') 
 322                                                                                 ->defaultValue($defaults['recover']['mail']['context']) 
 323                                                                                 ->variablePrototype()->end() 
 329                                         ->arrayNode('register') 
 330                                                 ->addDefaultsIfNotSet() 
 334                                                                 ->defaultValue($defaults['register']['route']) 
 335                                                                 ->scalarPrototype()->end() 
 338                                                                 ->addDefaultsIfNotSet() 
 340                                                                         ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['register']['view']['form'])->end() 
 341                                                                         ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['register']['view']['name'])->end() 
 342                                                                         ->arrayNode('context') 
 344                                                                                 ->defaultValue($defaults['register']['view']['context']) 
 345                                                                                 ->variablePrototype()->end() 
 350                                                                 ->addDefaultsIfNotSet() 
 352                                                                         ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['subject'])->end() 
 353                                                                         ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['html'])->end() 
 354                                                                         ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['text'])->end() 
 355                                                                         ->arrayNode('context') 
 357                                                                                 ->defaultValue($defaults['register']['mail']['context']) 
 358                                                                                 ->variablePrototype()->end()