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
|
1 |
|
public function getConfigTreeBuilder() |
23
|
|
|
{ |
24
|
1 |
|
$treeBuilder = new TreeBuilder('doyo_user'); |
25
|
|
|
|
26
|
|
|
//@codeCoverageIgnoreStart |
27
|
|
|
if (method_exists($treeBuilder, 'getRootNode')) { |
28
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
29
|
|
|
} else { |
30
|
|
|
$rootNode = $treeBuilder->root('doyo_user'); |
31
|
|
|
} |
32
|
|
|
//@codeCoverageIgnoreEnd |
33
|
|
|
|
34
|
|
|
$rootNode |
35
|
1 |
|
->children() |
36
|
1 |
|
->scalarNode('db_driver')->defaultValue('orm')->end() |
37
|
1 |
|
->scalarNode('user_class')->isRequired()->cannotBeEmpty()->end() |
38
|
1 |
|
->scalarNode('model_manager_name')->defaultValue('default')->end() |
39
|
1 |
|
->booleanNode('api_platform')->defaultValue(false)->end() |
40
|
1 |
|
->end(); |
41
|
1 |
|
$this->addServiceSection($rootNode); |
42
|
|
|
|
43
|
1 |
|
return $treeBuilder; |
44
|
|
|
} |
45
|
|
|
|
46
|
1 |
|
private function addServiceSection(ArrayNodeDefinition $node) |
47
|
|
|
{ |
48
|
|
|
$node |
49
|
1 |
|
->addDefaultsIfNotSet() |
50
|
1 |
|
->children() |
51
|
1 |
|
->arrayNode('service') |
52
|
1 |
|
->addDefaultsIfNotSet() |
53
|
1 |
|
->children() |
54
|
1 |
|
->scalarNode('email_canonicalizer')->defaultValue('doyo_user.util.canonicalizer.default')->end() |
55
|
1 |
|
->scalarNode('username_canonicalizer')->defaultValue('doyo_user.util.canonicalizer.default')->end() |
|
|
|
|
56
|
1 |
|
->scalarNode('password_updater')->defaultValue('doyo_user.util.password_updater.default')->end() |
57
|
1 |
|
->scalarNode('user_manager')->defaultValue('doyo_user.user_manager.default')->end() |
58
|
1 |
|
->end() |
59
|
1 |
|
->end() |
60
|
1 |
|
->end() |
61
|
1 |
|
->end(); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|