|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Tadcka package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Tadas Gliaubicas <[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 Tadcka\Bundle\RoutingBundle\DependencyInjection; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
15
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @author Tadas Gliaubicas <[email protected]> |
|
19
|
|
|
* |
|
20
|
|
|
* @since 7/1/14 11:09 PM |
|
21
|
|
|
*/ |
|
22
|
|
|
class Configuration implements ConfigurationInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritDoc} |
|
26
|
|
|
*/ |
|
27
|
|
|
public function getConfigTreeBuilder() |
|
28
|
|
|
{ |
|
29
|
|
|
$treeBuilder = new TreeBuilder(); |
|
30
|
|
|
$rootNode = $treeBuilder->root('tadcka_routing'); |
|
31
|
|
|
|
|
32
|
|
|
$rootNode |
|
33
|
|
|
->children() |
|
34
|
|
|
->scalarNode('db_driver')->cannotBeOverwritten()->isRequired()->end() |
|
35
|
|
|
->scalarNode('route_manager')->defaultValue('tadcka_routing.manager.route.default') |
|
36
|
|
|
->cannotBeEmpty()->end() |
|
37
|
|
|
->scalarNode('redirect_route_manager')->defaultValue('tadcka_routing.manager.redirect_route.default') |
|
38
|
|
|
->cannotBeEmpty()->end() |
|
39
|
|
|
|
|
40
|
|
|
->arrayNode('class')->isRequired() |
|
41
|
|
|
->children() |
|
42
|
|
|
->arrayNode('model')->isRequired() |
|
43
|
|
|
->children() |
|
44
|
|
|
->scalarNode('route')->isRequired()->end() |
|
45
|
|
|
->scalarNode('redirect_route')->isRequired()->end() |
|
46
|
|
|
->end() |
|
47
|
|
|
->end() |
|
48
|
|
|
->end() |
|
49
|
|
|
->end() |
|
50
|
|
|
|
|
51
|
|
|
->arrayNode('chain_router')->addDefaultsIfNotSet() |
|
52
|
|
|
->children() |
|
53
|
|
|
->booleanNode('enabled')->defaultFalse()->end() |
|
54
|
|
|
->end() |
|
55
|
|
|
->end() |
|
56
|
|
|
|
|
57
|
|
|
->arrayNode('dynamic_router')->addDefaultsIfNotSet() |
|
58
|
|
|
->children() |
|
59
|
|
|
->integerNode('priority')->defaultValue(0)->end() |
|
60
|
|
|
->end() |
|
61
|
|
|
->end() |
|
62
|
|
|
|
|
63
|
|
|
->arrayNode('router')->addDefaultsIfNotSet() |
|
64
|
|
|
->children() |
|
65
|
|
|
->integerNode('priority')->defaultValue(0)->end() |
|
66
|
|
|
->end() |
|
67
|
|
|
->end() |
|
68
|
|
|
|
|
69
|
|
|
->arrayNode('locales') |
|
70
|
|
|
->beforeNormalization() |
|
71
|
|
|
->ifString() |
|
72
|
|
|
->then(function($value) { return preg_split('/\s*,\s*/', $value); }) |
|
73
|
|
|
->end() |
|
74
|
|
|
->requiresAtLeastOneElement() |
|
75
|
|
|
->prototype('scalar')->end() |
|
76
|
|
|
->end() |
|
77
|
|
|
|
|
78
|
|
|
->end(); |
|
79
|
|
|
|
|
80
|
|
|
return $treeBuilder; |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|