forked from nextras/migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfiguration.php
66 lines (58 loc) · 1.64 KB
/
Configuration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* This file is part of the Nextras community extensions of Nette Framework
*
* @license New BSD License
* @link https://github.com/nextras/migrations
*/
namespace Nextras\Migrations\Bridges\SymfonyBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
if (!method_exists(TreeBuilder::class, '__construct')) { // Symfony < 4.2.0
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('nextras_migrations');
} else { // Symfony >= 4.2.0
$treeBuilder = new TreeBuilder('nextras_migrations');
$rootNode = $treeBuilder->getRootNode();
}
$rootNode->children()
->scalarNode('dir')
->defaultValue('%kernel.project_dir%/migrations')
->cannotBeEmpty()
->end()
->enumNode('dbal')
->values(['dibi', 'dibi2', 'dibi3', 'dibi4', 'doctrine', 'nette', 'nextras'])
->defaultValue('doctrine')
->cannotBeEmpty()
->end()
->enumNode('driver')
->values(['mysql', 'pgsql'])
->isRequired()
->cannotBeEmpty()
->end()
->enumNode('printer')
->values(['console', 'psrLog'])
->defaultValue('console')
->cannotBeEmpty()
->end()
->scalarNode('diff_generator')
->defaultValue('doctrine')
->end()
->booleanNode('with_dummy_data')
->defaultFalse()
->end()
->arrayNode('php_params')
->variablePrototype()
->end()
->end()
->scalarNode('ignored_queries_file')
->defaultNull()
->end()
->end();
return $treeBuilder;
}
}