3 namespace Rapsys\UserBundle\DependencyInjection
;
5 use Symfony\Component\Config\Definition\Builder\TreeBuilder
;
6 use Symfony\Component\Config\Definition\ConfigurationInterface
;
9 * This is the class that validates and merges configuration from your app/config files.
11 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
13 class Configuration
implements ConfigurationInterface
{
17 public function getConfigTreeBuilder() {
19 $treeBuilder = new TreeBuilder('rapsys_user');
21 //The bundle default values
24 'group' => 'Rapsys\\UserBundle\\Entity\\Group',
25 'civility' => 'Rapsys\\UserBundle\\Entity\\Civility',
26 'user' => 'Rapsys\\UserBundle\\Entity\\User'
29 'civility' => 'Mister',
34 'name' => 'rapsys_user_index',
38 'name' => 'rapsys_user_login',
42 'name' => 'rapsys_user_recover',
46 'name' => 'rapsys_user_recover_mail',
50 'name' => 'rapsys_user_register',
55 'locales' => '%kernel.translator.fallbacks%',
61 'mail' => 'contact@example.com'
64 'route' => ['index' => 'index_url'],
66 'name' => '@RapsysUser/form/login.html.twig',
67 'form' => 'Rapsys\UserBundle\Form\LoginType',
72 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
74 'name' => '@RapsysUser/form/recover.html.twig',
75 'form' => 'Rapsys\UserBundle\Form\RecoverType',
79 'subject' => 'Welcome back!',
80 'html' => '@RapsysUser/mail/recover.html.twig',
81 'text' => '@RapsysUser/mail/recover.text.twig',
86 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
88 'name' => '@RapsysUser/form/recover_mail.html.twig',
89 'form' => 'Rapsys\UserBundle\Form\RecoverMailType',
93 'subject' => 'Welcome back!',
94 'html' => '@RapsysUser/mail/recover_mail.html.twig',
95 'text' => '@RapsysUser/mail/recover_mail.text.twig',
100 'route' => ['index' => 'index_url'],
102 'form' => 'Rapsys\UserBundle\Form\RegisterType',
103 'name' => '@RapsysUser/form/register.html.twig',
107 'subject' => 'Welcome!',
108 'html' => '@RapsysUser/mail/register.html.twig',
109 'text' => '@RapsysUser/mail/register.text.twig',
115 //Here we define the parameters that are allowed to configure the bundle.
116 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
117 //TODO: see http://symfony.com/doc/current/components/config/definition.html
118 //TODO: see fosuser DependencyInjection/Configuration.php
119 //XXX: use bin/console config:dump-reference to dump class infos
121 //Here we define the parameters that are allowed to configure the bundle.
125 ->addDefaultsIfNotSet()
128 ->addDefaultsIfNotSet()
130 ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
131 ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['class']['civility'])->end()
132 ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
135 ->arrayNode('default')
136 ->addDefaultsIfNotSet()
138 ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['default']['civility'])->end()
140 ->treatNullLike(array())
141 ->defaultValue($defaults['default']['group'])
142 ->scalarPrototype()->end()
147 ->addDefaultsIfNotSet()
150 ->addDefaultsIfNotSet()
152 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['index']['name'])->end()
153 ->arrayNode('context')
154 ->treatNullLike(array())
155 ->defaultValue($defaults['route']['index']['context'])
156 ->scalarPrototype()->end()
161 ->addDefaultsIfNotSet()
163 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['login']['name'])->end()
164 ->arrayNode('context')
165 ->treatNullLike(array())
166 ->defaultValue($defaults['route']['login']['context'])
167 ->scalarPrototype()->end()
171 ->arrayNode('recover')
172 ->addDefaultsIfNotSet()
174 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover']['name'])->end()
175 ->arrayNode('context')
176 ->treatNullLike(array())
177 ->defaultValue($defaults['route']['recover']['context'])
178 ->scalarPrototype()->end()
182 ->arrayNode('recover_mail')
183 ->addDefaultsIfNotSet()
185 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover_mail']['name'])->end()
186 ->arrayNode('context')
187 ->treatNullLike(array())
188 ->defaultValue($defaults['route']['recover_mail']['context'])
189 ->scalarPrototype()->end()
193 ->arrayNode('register')
194 ->addDefaultsIfNotSet()
196 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['register']['name'])->end()
197 ->arrayNode('context')
198 ->treatNullLike(array())
199 ->defaultValue($defaults['route']['register']['context'])
200 ->scalarPrototype()->end()
206 ->arrayNode('translate')
207 ->treatNullLike(array())
208 ->defaultValue($defaults['translate'])
209 ->scalarPrototype()->end()
211 ->scalarNode('locales')->cannotBeEmpty()->defaultValue($defaults['locales'])->end()
212 ->arrayNode('languages')
214 ->defaultValue($defaults['languages'])
215 ->scalarPrototype()->end()
217 ->arrayNode('contact')
218 ->addDefaultsIfNotSet()
220 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
221 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
225 ->addDefaultsIfNotSet()
228 ->treatNullLike(array())
229 ->defaultValue($defaults['login']['route'])
230 ->scalarPrototype()->end()
233 ->addDefaultsIfNotSet()
235 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['login']['view']['name'])->end()
236 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['login']['view']['form'])->end()
237 ->arrayNode('context')
238 ->treatNullLike(array())
239 ->defaultValue($defaults['login']['view']['context'])
240 ->variablePrototype()->end()
246 ->arrayNode('recover')
247 ->addDefaultsIfNotSet()
250 ->treatNullLike(array())
251 ->defaultValue($defaults['recover']['route'])
252 ->scalarPrototype()->end()
255 ->addDefaultsIfNotSet()
257 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['name'])->end()
258 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['form'])->end()
259 ->arrayNode('context')
260 ->treatNullLike(array())
261 ->defaultValue($defaults['recover']['view']['context'])
262 ->variablePrototype()->end()
267 ->addDefaultsIfNotSet()
269 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['subject'])->end()
270 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['html'])->end()
271 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['text'])->end()
272 ->arrayNode('context')
273 ->treatNullLike(array())
274 ->defaultValue($defaults['recover']['mail']['context'])
275 ->variablePrototype()->end()
281 ->arrayNode('recover_mail')
282 ->addDefaultsIfNotSet()
285 ->treatNullLike(array())
286 ->defaultValue($defaults['recover_mail']['route'])
287 ->scalarPrototype()->end()
290 ->addDefaultsIfNotSet()
292 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['name'])->end()
293 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['form'])->end()
294 ->arrayNode('context')
295 ->treatNullLike(array())
296 ->defaultValue($defaults['recover_mail']['view']['context'])
297 ->variablePrototype()->end()
302 ->addDefaultsIfNotSet()
304 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['subject'])->end()
305 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['html'])->end()
306 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['text'])->end()
307 ->arrayNode('context')
308 ->treatNullLike(array())
309 ->defaultValue($defaults['recover_mail']['mail']['context'])
310 ->variablePrototype()->end()
316 ->arrayNode('register')
317 ->addDefaultsIfNotSet()
320 ->treatNullLike(array())
321 ->defaultValue($defaults['register']['route'])
322 ->scalarPrototype()->end()
325 ->addDefaultsIfNotSet()
327 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['register']['view']['form'])->end()
328 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['register']['view']['name'])->end()
329 ->arrayNode('context')
330 ->treatNullLike(array())
331 ->defaultValue($defaults['register']['view']['context'])
332 ->variablePrototype()->end()
337 ->addDefaultsIfNotSet()
339 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['subject'])->end()
340 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['html'])->end()
341 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['text'])->end()
342 ->arrayNode('context')
343 ->treatNullLike(array())
344 ->defaultValue($defaults['register']['mail']['context'])
345 ->variablePrototype()->end()