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_homepage',
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'
56 'name' => '@RapsysUser/form/login.html.twig',
57 'form' => 'Rapsys\UserBundle\Form\LoginType',
63 'name' => '@RapsysUser/form/recover.html.twig',
64 'form' => 'Rapsys\UserBundle\Form\RecoverType',
68 'subject' => 'Welcome back!',
69 'html' => '@RapsysUser/mail/recover.html.twig',
70 'text' => '@RapsysUser/mail/recover.text.twig',
71 'route' => ['homepage' => 'homepage_url', 'recover_mail' => 'recover_url'],
77 'name' => '@RapsysUser/form/recover_mail.html.twig',
78 'form' => 'Rapsys\UserBundle\Form\RecoverMailType',
82 'subject' => 'Welcome back!',
83 'html' => '@RapsysUser/mail/recover_mail.html.twig',
84 'text' => '@RapsysUser/mail/recover_mail.text.twig',
85 'route' => ['homepage' => 'homepage_url'],
91 'form' => 'Rapsys\UserBundle\Form\RegisterType',
92 'name' => '@RapsysUser/form/register.html.twig',
96 'subject' => 'Welcome!',
97 'html' => '@RapsysUser/mail/register.html.twig',
98 'text' => '@RapsysUser/mail/register.text.twig',
99 'route' => ['homepage' => 'homepage_url'],
105 //Here we define the parameters that are allowed to configure the bundle.
106 //TODO: see https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php for default value and description
107 //TODO: see http://symfony.com/doc/current/components/config/definition.html
108 //TODO: see fosuser DependencyInjection/Configuration.php
109 //XXX: use bin/console config:dump-reference to dump class infos
111 //Here we define the parameters that are allowed to configure the bundle.
115 ->addDefaultsIfNotSet()
118 ->addDefaultsIfNotSet()
120 ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end()
121 ->scalarNode('title')->cannotBeEmpty()->defaultValue($defaults['class']['title'])->end()
122 ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end()
126 ->addDefaultsIfNotSet()
128 ->arrayNode('homepage')
129 ->addDefaultsIfNotSet()
131 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['homepage']['name'])->end()
132 ->arrayNode('context')
133 ->treatNullLike(array())
134 ->defaultValue($defaults['route']['homepage']['context'])
135 ->scalarPrototype()->end()
140 ->addDefaultsIfNotSet()
142 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['login']['name'])->end()
143 ->arrayNode('context')
144 ->treatNullLike(array())
145 ->defaultValue($defaults['route']['login']['context'])
146 ->scalarPrototype()->end()
150 ->arrayNode('recover')
151 ->addDefaultsIfNotSet()
153 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover']['name'])->end()
154 ->arrayNode('context')
155 ->treatNullLike(array())
156 ->defaultValue($defaults['route']['recover']['context'])
157 ->scalarPrototype()->end()
161 ->arrayNode('recover_mail')
162 ->addDefaultsIfNotSet()
164 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['recover_mail']['name'])->end()
165 ->arrayNode('context')
166 ->treatNullLike(array())
167 ->defaultValue($defaults['route']['recover_mail']['context'])
168 ->scalarPrototype()->end()
172 ->arrayNode('register')
173 ->addDefaultsIfNotSet()
175 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['route']['register']['name'])->end()
176 ->arrayNode('context')
177 ->treatNullLike(array())
178 ->defaultValue($defaults['route']['register']['context'])
179 ->scalarPrototype()->end()
185 ->arrayNode('contact')
186 ->addDefaultsIfNotSet()
188 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['contact']['name'])->end()
189 ->scalarNode('mail')->cannotBeEmpty()->defaultValue($defaults['contact']['mail'])->end()
193 ->addDefaultsIfNotSet()
196 ->addDefaultsIfNotSet()
198 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['login']['view']['name'])->end()
199 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['login']['view']['form'])->end()
200 ->arrayNode('context')
201 ->treatNullLike(array())
202 ->defaultValue($defaults['login']['view']['context'])
203 ->scalarPrototype()->end()
209 ->arrayNode('recover')
210 ->addDefaultsIfNotSet()
213 ->addDefaultsIfNotSet()
215 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['name'])->end()
216 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover']['view']['form'])->end()
217 ->arrayNode('context')
218 ->treatNullLike(array())
219 ->defaultValue($defaults['recover']['view']['context'])
220 ->scalarPrototype()->end()
225 ->addDefaultsIfNotSet()
227 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['subject'])->end()
228 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['html'])->end()
229 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover']['mail']['text'])->end()
231 ->treatNullLike(array())
232 ->defaultValue($defaults['recover']['mail']['route'])
233 ->scalarPrototype()->end()
235 ->arrayNode('context')
236 ->treatNullLike(array())
237 ->defaultValue($defaults['recover']['mail']['context'])
238 ->scalarPrototype()->end()
244 ->arrayNode('recover_mail')
245 ->addDefaultsIfNotSet()
248 ->addDefaultsIfNotSet()
250 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['name'])->end()
251 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['view']['form'])->end()
252 ->arrayNode('context')
253 ->treatNullLike(array())
254 ->defaultValue($defaults['recover_mail']['view']['context'])
255 ->scalarPrototype()->end()
260 ->addDefaultsIfNotSet()
262 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['subject'])->end()
263 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['html'])->end()
264 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['recover_mail']['mail']['text'])->end()
266 ->treatNullLike(array())
267 ->defaultValue($defaults['recover_mail']['mail']['route'])
268 ->scalarPrototype()->end()
270 ->arrayNode('context')
271 ->treatNullLike(array())
272 ->defaultValue($defaults['recover_mail']['mail']['context'])
273 ->scalarPrototype()->end()
279 ->arrayNode('register')
280 ->addDefaultsIfNotSet()
283 ->addDefaultsIfNotSet()
285 ->scalarNode('form')->cannotBeEmpty()->defaultValue($defaults['register']['view']['form'])->end()
286 ->scalarNode('name')->cannotBeEmpty()->defaultValue($defaults['register']['view']['name'])->end()
287 ->arrayNode('context')
288 ->treatNullLike(array())
289 ->defaultValue($defaults['register']['view']['context'])
290 ->scalarPrototype()->end()
295 ->addDefaultsIfNotSet()
297 ->scalarNode('subject')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['subject'])->end()
298 ->scalarNode('html')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['html'])->end()
299 ->scalarNode('text')->cannotBeEmpty()->defaultValue($defaults['register']['mail']['text'])->end()
301 ->treatNullLike(array())
302 ->defaultValue($defaults['register']['mail']['route'])
303 ->scalarPrototype()->end()
305 ->arrayNode('context')
306 ->treatNullLike(array())
307 ->defaultValue($defaults['register']['mail']['context'])
308 ->scalarPrototype()->end()