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 'title' => 'Rapsys\\UserBundle\\Entity\\Title',
26 'user' => 'Rapsys\\UserBundle\\Entity\\User'
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',
56 'mail' => 'contact@example.com'
59 'route' => ['index' => 'index_url'],
61 'name' => '@RapsysUser/form/login.html.twig',
62 'form' => 'Rapsys\UserBundle\Form\LoginType',
67 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
69 'name' => '@RapsysUser/form/recover.html.twig',
70 'form' => 'Rapsys\UserBundle\Form\RecoverType',
74 'subject' => 'Welcome back!',
75 'html' => '@RapsysUser/mail/recover.html.twig',
76 'text' => '@RapsysUser/mail/recover.text.twig',
81 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
83 'name' => '@RapsysUser/form/recover_mail.html.twig',
84 'form' => 'Rapsys\UserBundle\Form\RecoverMailType',
88 'subject' => 'Welcome back!',
89 'html' => '@RapsysUser/mail/recover_mail.html.twig',
90 'text' => '@RapsysUser/mail/recover_mail.text.twig',
95 'route' => ['index' => 'index_url'],
97 'form' => 'Rapsys\UserBundle\Form\RegisterType',
98 'name' => '@RapsysUser/form/register.html.twig',
102 'subject' => 'Welcome!',
103 'html' => '@RapsysUser/mail/register.html.twig',
104 'text' => '@RapsysUser/mail/register.text.twig',
110 //Here we define the parameters that are allowed to configure the bundle.
111 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
112 //TODO: see http://symfony.com/doc/current/components/config/definition.html
113 //TODO: see fosuser DependencyInjection/Configuration.php
114 //XXX: use bin/console config:dump-reference to dump class infos
116 //Here we define the parameters that are allowed to configure the bundle.
120 ->addDefaultsIfNotSet()
123 ->addDefaultsIfNotSet()
125 ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
126 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['class']['title'])->end()
127 ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
130 ->arrayNode('default')
131 ->addDefaultsIfNotSet()
133 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['default']['title'])->end()
135 ->treatNullLike(array())
136 ->defaultValue($defaults['default']['group'])
137 ->scalarPrototype()->end()
142 ->addDefaultsIfNotSet()
145 ->addDefaultsIfNotSet()
147 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['index']['name'])->end()
148 ->arrayNode('context')
149 ->treatNullLike(array())
150 ->defaultValue($defaults['route']['index']['context'])
151 ->scalarPrototype()->end()
156 ->addDefaultsIfNotSet()
158 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['login']['name'])->end()
159 ->arrayNode('context')
160 ->treatNullLike(array())
161 ->defaultValue($defaults['route']['login']['context'])
162 ->scalarPrototype()->end()
166 ->arrayNode('recover')
167 ->addDefaultsIfNotSet()
169 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover']['name'])->end()
170 ->arrayNode('context')
171 ->treatNullLike(array())
172 ->defaultValue($defaults['route']['recover']['context'])
173 ->scalarPrototype()->end()
177 ->arrayNode('recover_mail')
178 ->addDefaultsIfNotSet()
180 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover_mail']['name'])->end()
181 ->arrayNode('context')
182 ->treatNullLike(array())
183 ->defaultValue($defaults['route']['recover_mail']['context'])
184 ->scalarPrototype()->end()
188 ->arrayNode('register')
189 ->addDefaultsIfNotSet()
191 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['register']['name'])->end()
192 ->arrayNode('context')
193 ->treatNullLike(array())
194 ->defaultValue($defaults['route']['register']['context'])
195 ->scalarPrototype()->end()
201 ->arrayNode('contact')
202 ->addDefaultsIfNotSet()
204 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
205 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
209 ->addDefaultsIfNotSet()
212 ->treatNullLike(array())
213 ->defaultValue($defaults['login']['route'])
214 ->scalarPrototype()->end()
217 ->addDefaultsIfNotSet()
219 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['login']['view']['name'])->end()
220 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['login']['view']['form'])->end()
221 ->arrayNode('context')
222 ->treatNullLike(array())
223 ->defaultValue($defaults['login']['view']['context'])
224 ->variablePrototype()->end()
230 ->arrayNode('recover')
231 ->addDefaultsIfNotSet()
234 ->treatNullLike(array())
235 ->defaultValue($defaults['recover']['route'])
236 ->scalarPrototype()->end()
239 ->addDefaultsIfNotSet()
241 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['name'])->end()
242 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['form'])->end()
243 ->arrayNode('context')
244 ->treatNullLike(array())
245 ->defaultValue($defaults['recover']['view']['context'])
246 ->variablePrototype()->end()
251 ->addDefaultsIfNotSet()
253 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['subject'])->end()
254 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['html'])->end()
255 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['text'])->end()
256 ->arrayNode('context')
257 ->treatNullLike(array())
258 ->defaultValue($defaults['recover']['mail']['context'])
259 ->variablePrototype()->end()
265 ->arrayNode('recover_mail')
266 ->addDefaultsIfNotSet()
269 ->treatNullLike(array())
270 ->defaultValue($defaults['recover_mail']['route'])
271 ->scalarPrototype()->end()
274 ->addDefaultsIfNotSet()
276 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['name'])->end()
277 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['form'])->end()
278 ->arrayNode('context')
279 ->treatNullLike(array())
280 ->defaultValue($defaults['recover_mail']['view']['context'])
281 ->variablePrototype()->end()
286 ->addDefaultsIfNotSet()
288 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['subject'])->end()
289 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['html'])->end()
290 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['text'])->end()
291 ->arrayNode('context')
292 ->treatNullLike(array())
293 ->defaultValue($defaults['recover_mail']['mail']['context'])
294 ->variablePrototype()->end()
300 ->arrayNode('register')
301 ->addDefaultsIfNotSet()
304 ->treatNullLike(array())
305 ->defaultValue($defaults['register']['route'])
306 ->scalarPrototype()->end()
309 ->addDefaultsIfNotSet()
311 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['register']['view']['form'])->end()
312 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['register']['view']['name'])->end()
313 ->arrayNode('context')
314 ->treatNullLike(array())
315 ->defaultValue($defaults['register']['view']['context'])
316 ->variablePrototype()->end()
321 ->addDefaultsIfNotSet()
323 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['subject'])->end()
324 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['html'])->end()
325 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['text'])->end()
326 ->arrayNode('context')
327 ->treatNullLike(array())
328 ->defaultValue($defaults['register']['mail']['context'])
329 ->variablePrototype()->end()