|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the PommProject/PommBundle package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) 2014 Grégoire HUBERT <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
namespace PommProject\PommBundle\DependencyInjection; |
|
11
|
|
|
|
|
12
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
13
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Configuration |
|
17
|
|
|
* |
|
18
|
|
|
* Configuration manager. |
|
19
|
|
|
* |
|
20
|
|
|
* @package PommBundle |
|
21
|
|
|
* @copyright 2014 Grégoire HUBERT |
|
22
|
|
|
* @author Nicolas JOSEPH |
|
23
|
|
|
* @license X11 {@link http://opensource.org/licenses/mit-license.php} |
|
24
|
|
|
* @see ConfigurationInterface |
|
25
|
|
|
*/ |
|
26
|
|
|
class Configuration implements ConfigurationInterface |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* getConfigTreeBuilder |
|
30
|
|
|
* |
|
31
|
|
|
* @see ConfigurationInterface |
|
32
|
|
|
*/ |
|
33
|
|
|
public function getConfigTreeBuilder() |
|
34
|
|
|
{ |
|
35
|
|
|
$treeBuilder = new TreeBuilder('pomm'); |
|
36
|
|
|
$rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('pomm'); |
|
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
$rootNode |
|
39
|
|
|
->children() |
|
40
|
|
|
->arrayNode('configuration') |
|
41
|
|
|
->useAttributeAsKey('key') |
|
42
|
|
|
->requiresAtLeastOneElement() |
|
43
|
|
|
->prototype('array') |
|
44
|
|
|
->children() |
|
45
|
|
|
->scalarNode('dsn')->isRequired()->end() |
|
46
|
|
|
->scalarNode('class:session_builder') |
|
47
|
|
|
->defaultNull() |
|
48
|
|
|
->beforeNormalization() |
|
49
|
|
|
->always() |
|
50
|
|
|
->then(function ($v) { |
|
51
|
|
|
@trigger_error('class:session_builder is deprecated since version 2.3 and will be removed in 3.0. Use session_builder config key instead with a service id.', E_USER_DEPRECATED); |
|
|
|
|
|
|
52
|
|
|
return $v; |
|
53
|
|
|
}) |
|
54
|
|
|
->end() |
|
55
|
|
|
->end() |
|
56
|
|
|
->scalarNode('session_builder')->defaultNull()->end() |
|
57
|
|
|
->scalarNode('pomm:default')->end() |
|
58
|
|
|
->end() |
|
59
|
|
|
->validate() |
|
60
|
|
|
->ifTrue(function ($v) { |
|
61
|
|
|
return isset($v['session_builder']) && isset($v['class:session_builder']); |
|
62
|
|
|
}) |
|
63
|
|
|
->thenInvalid('You cannot use both "session_builder" and "class:session_builder" at the same time.') |
|
64
|
|
|
->end() |
|
65
|
|
|
->beforeNormalization() |
|
66
|
|
|
->always() |
|
67
|
|
|
->then(function ($v) { |
|
68
|
|
|
if (!isset($v['session_builder']) && !isset($v['class:session_builder'])) { |
|
69
|
|
|
$v['session_builder'] = 'pomm.model_manager.session_builder'; |
|
70
|
|
|
} |
|
71
|
|
|
return $v; |
|
72
|
|
|
}) |
|
73
|
|
|
->end() |
|
74
|
|
|
->end() |
|
75
|
|
|
->end() |
|
76
|
|
|
->arrayNode('logger') |
|
77
|
|
|
->children() |
|
78
|
|
|
->scalarNode('service')->end() |
|
79
|
|
|
->end() |
|
80
|
|
|
->end() |
|
81
|
|
|
->end(); |
|
82
|
|
|
|
|
83
|
|
|
return $treeBuilder; |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.