|
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
|
30 |
|
public function getConfigTreeBuilder() |
|
32
|
|
|
{ |
|
33
|
30 |
|
$treeBuilder = new TreeBuilder(); |
|
34
|
30 |
|
$rootNode = $treeBuilder->root('hautelook_alice'); |
|
35
|
|
|
|
|
36
|
|
|
$rootNode |
|
37
|
30 |
|
->children() |
|
38
|
30 |
|
->arrayNode('db_drivers') |
|
39
|
30 |
|
->info('The list of enabled drivers.') |
|
40
|
30 |
|
->addDefaultsIfNotSet() |
|
41
|
30 |
|
->cannotBeOverwritten() |
|
42
|
30 |
|
->children() |
|
43
|
30 |
|
->booleanNode(self::ORM_DRIVER) |
|
44
|
30 |
|
->defaultValue(null) |
|
45
|
30 |
|
->end() |
|
46
|
30 |
|
->booleanNode(self::MONGODB_DRIVER) |
|
47
|
30 |
|
->defaultValue(null) |
|
48
|
30 |
|
->end() |
|
49
|
30 |
|
->booleanNode(self::PHPCR_DRIVER) |
|
50
|
30 |
|
->defaultValue(null) |
|
51
|
30 |
|
->end() |
|
52
|
30 |
|
->end() |
|
53
|
30 |
|
->end() |
|
54
|
30 |
|
->scalarNode('locale') |
|
55
|
30 |
|
->defaultValue('en_US') |
|
56
|
30 |
|
->info('Locale to use with faker') |
|
57
|
30 |
|
->end() |
|
58
|
30 |
|
->integerNode('seed') |
|
59
|
30 |
|
->defaultValue(1) |
|
60
|
30 |
|
->info('A seed to make sure faker generates data consistently across runs, set to null to disable') |
|
61
|
30 |
|
->end() |
|
62
|
30 |
|
->booleanNode('persist_once') |
|
63
|
30 |
|
->defaultValue(false) |
|
64
|
30 |
|
->info('Only persist objects once if multiple files are passed') |
|
65
|
30 |
|
->end() |
|
66
|
30 |
|
->scalarNode('loading_limit') |
|
67
|
30 |
|
->defaultValue(5) |
|
68
|
30 |
|
->info('Maximum number of time the loader will try to load the files passed') |
|
69
|
30 |
|
->end() |
|
70
|
30 |
|
->end() |
|
71
|
|
|
; |
|
72
|
|
|
|
|
73
|
30 |
|
return $treeBuilder; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|