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'
30 'name' => 'rapsys_user_index',
34 'name' => 'rapsys_user_login',
38 'name' => 'rapsys_user_recover',
42 'name' => 'rapsys_user_recover_mail',
46 'name' => 'rapsys_user_register',
52 'mail' => 'contact@example.com'
55 'route' => ['index' => 'index_url'],
57 'name' => '@RapsysUser/form/login.html.twig',
58 'form' => 'Rapsys\UserBundle\Form\LoginType',
63 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
65 'name' => '@RapsysUser/form/recover.html.twig',
66 'form' => 'Rapsys\UserBundle\Form\RecoverType',
70 'subject' => 'Welcome back!',
71 'html' => '@RapsysUser/mail/recover.html.twig',
72 'text' => '@RapsysUser/mail/recover.text.twig',
77 'route' => ['index' => 'index_url', 'recover_mail' => 'recover_url'],
79 'name' => '@RapsysUser/form/recover_mail.html.twig',
80 'form' => 'Rapsys\UserBundle\Form\RecoverMailType',
84 'subject' => 'Welcome back!',
85 'html' => '@RapsysUser/mail/recover_mail.html.twig',
86 'text' => '@RapsysUser/mail/recover_mail.text.twig',
91 'route' => ['index' => 'index_url'],
93 'form' => 'Rapsys\UserBundle\Form\RegisterType',
94 'name' => '@RapsysUser/form/register.html.twig',
98 'subject' => 'Welcome!',
99 'html' => '@RapsysUser/mail/register.html.twig',
100 'text' => '@RapsysUser/mail/register.text.twig',
106 //Here we define the parameters that are allowed to configure the bundle.
107 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
108 //TODO: see http://symfony.com/doc/current/components/config/definition.html
109 //TODO: see fosuser DependencyInjection/Configuration.php
110 //XXX: use bin/console config:dump-reference to dump class infos
112 //Here we define the parameters that are allowed to configure the bundle.
116 ->addDefaultsIfNotSet()
119 ->addDefaultsIfNotSet()
121 ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
122 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['class']['title'])->end()
123 ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
127 ->addDefaultsIfNotSet()
130 ->addDefaultsIfNotSet()
132 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['index']['name'])->end()
133 ->arrayNode('context')
134 ->treatNullLike(array())
135 ->defaultValue($defaults['route']['index']['context'])
136 ->scalarPrototype()->end()
141 ->addDefaultsIfNotSet()
143 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['login']['name'])->end()
144 ->arrayNode('context')
145 ->treatNullLike(array())
146 ->defaultValue($defaults['route']['login']['context'])
147 ->scalarPrototype()->end()
151 ->arrayNode('recover')
152 ->addDefaultsIfNotSet()
154 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover']['name'])->end()
155 ->arrayNode('context')
156 ->treatNullLike(array())
157 ->defaultValue($defaults['route']['recover']['context'])
158 ->scalarPrototype()->end()
162 ->arrayNode('recover_mail')
163 ->addDefaultsIfNotSet()
165 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover_mail']['name'])->end()
166 ->arrayNode('context')
167 ->treatNullLike(array())
168 ->defaultValue($defaults['route']['recover_mail']['context'])
169 ->scalarPrototype()->end()
173 ->arrayNode('register')
174 ->addDefaultsIfNotSet()
176 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['register']['name'])->end()
177 ->arrayNode('context')
178 ->treatNullLike(array())
179 ->defaultValue($defaults['route']['register']['context'])
180 ->scalarPrototype()->end()
186 ->arrayNode('contact')
187 ->addDefaultsIfNotSet()
189 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
190 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
194 ->addDefaultsIfNotSet()
197 ->treatNullLike(array())
198 ->defaultValue($defaults['login']['route'])
199 ->scalarPrototype()->end()
202 ->addDefaultsIfNotSet()
204 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['login']['view']['name'])->end()
205 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['login']['view']['form'])->end()
206 ->arrayNode('context')
207 ->treatNullLike(array())
208 ->defaultValue($defaults['login']['view']['context'])
209 ->variablePrototype()->end()
215 ->arrayNode('recover')
216 ->addDefaultsIfNotSet()
219 ->treatNullLike(array())
220 ->defaultValue($defaults['recover']['route'])
221 ->scalarPrototype()->end()
224 ->addDefaultsIfNotSet()
226 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['name'])->end()
227 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['form'])->end()
228 ->arrayNode('context')
229 ->treatNullLike(array())
230 ->defaultValue($defaults['recover']['view']['context'])
231 ->variablePrototype()->end()
236 ->addDefaultsIfNotSet()
238 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['subject'])->end()
239 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['html'])->end()
240 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['text'])->end()
241 ->arrayNode('context')
242 ->treatNullLike(array())
243 ->defaultValue($defaults['recover']['mail']['context'])
244 ->variablePrototype()->end()
250 ->arrayNode('recover_mail')
251 ->addDefaultsIfNotSet()
254 ->treatNullLike(array())
255 ->defaultValue($defaults['recover_mail']['route'])
256 ->scalarPrototype()->end()
259 ->addDefaultsIfNotSet()
261 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['name'])->end()
262 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['form'])->end()
263 ->arrayNode('context')
264 ->treatNullLike(array())
265 ->defaultValue($defaults['recover_mail']['view']['context'])
266 ->variablePrototype()->end()
271 ->addDefaultsIfNotSet()
273 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['subject'])->end()
274 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['html'])->end()
275 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['text'])->end()
276 ->arrayNode('context')
277 ->treatNullLike(array())
278 ->defaultValue($defaults['recover_mail']['mail']['context'])
279 ->variablePrototype()->end()
285 ->arrayNode('register')
286 ->addDefaultsIfNotSet()
289 ->treatNullLike(array())
290 ->defaultValue($defaults['register']['route'])
291 ->scalarPrototype()->end()
294 ->addDefaultsIfNotSet()
296 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['register']['view']['form'])->end()
297 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['register']['view']['name'])->end()
298 ->arrayNode('context')
299 ->treatNullLike(array())
300 ->defaultValue($defaults['register']['view']['context'])
301 ->variablePrototype()->end()
306 ->addDefaultsIfNotSet()
308 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['subject'])->end()
309 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['html'])->end()
310 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['text'])->end()
311 ->arrayNode('context')
312 ->treatNullLike(array())
313 ->defaultValue($defaults['register']['mail']['context'])
314 ->variablePrototype()->end()