1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Hautelook\AliceBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Baldur Rensch <[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
|
|
|
namespace Hautelook\AliceBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The configuration of the bundle. |
19
|
|
|
* |
20
|
|
|
* @author Baldur Rensch <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
class Configuration implements ConfigurationInterface |
23
|
|
|
{ |
24
|
|
|
const ORM_DRIVER = 'orm'; |
25
|
|
|
const MONGODB_DRIVER = 'mongodb'; |
26
|
|
|
const PHPCR_DRIVER = 'phpcr'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
27 |
|
public function getConfigTreeBuilder() |
32
|
|
|
{ |
33
|
27 |
|
$treeBuilder = new TreeBuilder(); |
34
|
27 |
|
$rootNode = $treeBuilder->root('hautelook_alice'); |
35
|
|
|
|
36
|
|
|
$rootNode |
37
|
27 |
|
->children() |
38
|
27 |
|
->arrayNode('db_drivers') |
39
|
27 |
|
->info('The list of enabled drivers.') |
40
|
27 |
|
->addDefaultsIfNotSet() |
41
|
27 |
|
->cannotBeOverwritten() |
42
|
27 |
|
->children() |
43
|
27 |
|
->booleanNode(self::ORM_DRIVER) |
44
|
27 |
|
->defaultValue(null) |
45
|
27 |
|
->end() |
46
|
27 |
|
->booleanNode(self::MONGODB_DRIVER) |
47
|
27 |
|
->defaultValue(null) |
48
|
27 |
|
->end() |
49
|
27 |
|
->booleanNode(self::PHPCR_DRIVER) |
50
|
27 |
|
->defaultValue(null) |
51
|
27 |
|
->end() |
52
|
27 |
|
->end() |
53
|
27 |
|
->end() |
54
|
27 |
|
->scalarNode('locale') |
55
|
27 |
|
->defaultValue('en_US') |
56
|
27 |
|
->info('Locale to use with faker') |
57
|
27 |
|
->end() |
58
|
27 |
|
->integerNode('seed') |
59
|
27 |
|
->defaultValue(1) |
60
|
27 |
|
->info('A seed to make sure faker generates data consistently across runs, set to null to disable') |
61
|
27 |
|
->end() |
62
|
27 |
|
->booleanNode('persist_once') |
63
|
27 |
|
->defaultValue(false) |
64
|
27 |
|
->info('Only persist objects once if multiple files are passed') |
65
|
27 |
|
->end() |
66
|
27 |
|
->scalarNode('loading_limit') |
67
|
27 |
|
->defaultValue(5) |
68
|
27 |
|
->info('Maximum number of time the loader will try to load the files passed') |
69
|
27 |
|
->end() |
70
|
27 |
|
->end() |
71
|
|
|
; |
72
|
|
|
|
73
|
27 |
|
return $treeBuilder; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|