1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the DoyoUserBundle project. |
5
|
|
|
* |
6
|
|
|
* (c) Anthonius Munthi <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Doyo\UserBundle\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
17
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
18
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
19
|
|
|
|
20
|
|
|
class Configuration implements ConfigurationInterface |
21
|
|
|
{ |
22
|
3 |
|
public function getConfigTreeBuilder() |
23
|
|
|
{ |
24
|
3 |
|
$treeBuilder = new TreeBuilder('doyo_user'); |
25
|
|
|
|
26
|
3 |
|
if (method_exists($treeBuilder, 'getRootNode')) { |
27
|
3 |
|
$rootNode = $treeBuilder->getRootNode(); |
28
|
|
|
} else { |
29
|
|
|
$rootNode = $treeBuilder->root('doyo_user'); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$rootNode |
33
|
3 |
|
->children() |
34
|
3 |
|
->scalarNode('db_driver')->defaultValue('orm')->end() |
35
|
3 |
|
->scalarNode('user_class')->isRequired()->cannotBeEmpty()->end() |
36
|
3 |
|
->scalarNode('model_manager_name')->defaultValue('default')->end() |
37
|
3 |
|
->booleanNode('api_platform')->defaultValue(false)->end() |
38
|
3 |
|
->end(); |
39
|
|
|
|
40
|
3 |
|
$this->addServiceSection($rootNode); |
41
|
3 |
|
$this->addGroupSection($rootNode); |
42
|
|
|
|
43
|
3 |
|
return $treeBuilder; |
44
|
|
|
} |
45
|
|
|
|
46
|
3 |
|
private function addServiceSection(ArrayNodeDefinition $node) |
47
|
|
|
{ |
48
|
|
|
$node |
49
|
3 |
|
->addDefaultsIfNotSet() |
50
|
3 |
|
->children() |
51
|
3 |
|
->arrayNode('service') |
52
|
3 |
|
->addDefaultsIfNotSet() |
53
|
3 |
|
->children() |
54
|
3 |
|
->scalarNode('email_canonicalizer')->defaultValue('doyo_user.util.canonicalizer.default')->end() |
55
|
3 |
|
->scalarNode('username_canonicalizer')->defaultValue('doyo_user.util.canonicalizer.default')->end() |
|
|
|
|
56
|
3 |
|
->scalarNode('password_updater')->defaultValue('doyo_user.util.password_updater.default')->end() |
57
|
3 |
|
->scalarNode('user_manager')->defaultValue('doyo_user.user_manager.default')->end() |
58
|
3 |
|
->end() |
59
|
3 |
|
->end() |
60
|
3 |
|
->end() |
61
|
3 |
|
->end(); |
62
|
|
|
} |
63
|
|
|
|
64
|
3 |
|
private function addGroupSection(ArrayNodeDefinition $node) |
65
|
|
|
{ |
66
|
|
|
$node |
67
|
3 |
|
->children() |
68
|
3 |
|
->arrayNode('group') |
69
|
3 |
|
->canBeUnset() |
70
|
3 |
|
->children() |
71
|
3 |
|
->scalarNode('group_class')->isRequired()->cannotBeEmpty()->end() |
72
|
3 |
|
->scalarNode('group_manager')->defaultValue('doyo_user.group_manager.default')->end() |
73
|
3 |
|
->end() |
74
|
3 |
|
->end() |
75
|
3 |
|
->end(); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.