|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Majora\Bundle\FrameworkExtraBundle\DependencyInjection; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Config\FileLocator; |
|
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
7
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
8
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* This is the class that loads and manages your bundle configuration. |
|
12
|
|
|
* |
|
13
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
14
|
|
|
*/ |
|
15
|
|
|
class MajoraFrameworkExtraExtension extends Extension |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
2 |
|
public function load(array $configs, ContainerBuilder $container) |
|
21
|
|
|
{ |
|
22
|
2 |
|
$configuration = new Configuration(); |
|
23
|
2 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
24
|
|
|
|
|
25
|
2 |
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
26
|
2 |
|
$loader->load('serializer.xml'); |
|
27
|
2 |
|
$loader->load('http.xml'); |
|
28
|
2 |
|
$loader->load('services.xml'); |
|
29
|
2 |
|
$loader->load('loader_bridge_form.xml'); |
|
30
|
|
|
|
|
31
|
|
|
// clock mocker |
|
32
|
2 |
|
if (!empty($config['clock']['enabled'])) { |
|
33
|
|
|
$loader->load('clock.xml'); |
|
34
|
|
|
$container->getDefinition('majora.clock')->replaceArgument( |
|
35
|
|
|
0, |
|
36
|
|
|
$config['clock']['mock_param'] |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
// translations |
|
41
|
2 |
|
if (!empty($config['translations']['enabled'])) { |
|
42
|
|
|
$container->setParameter( |
|
43
|
|
|
'majora.translations.enabled_locales', |
|
44
|
|
|
$config['translations']['locales'] |
|
45
|
|
|
); |
|
46
|
|
|
$loader->load('translations.xml'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
// agnostic url generator |
|
50
|
2 |
|
if (!empty($config['agnostic_url_generator']['enabled'])) { |
|
51
|
|
|
$loader->load('agnostic_url_generator.xml'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
// exception listener |
|
55
|
2 |
|
if (!empty($config['exception_listener']['enabled'])) { |
|
56
|
|
|
$loader->load('exception_listener.xml'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
// doctrine events proxy |
|
60
|
2 |
|
if (!empty($config['doctrine_events_proxy']['enabled'])) { |
|
61
|
|
|
$loader->load('doctrine_events_proxy.xml'); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
// json form extension |
|
65
|
2 |
|
if (!empty($config['json_form_extension']['enabled'])) { |
|
66
|
2 |
|
$loader->load('json_form_extension.xml'); |
|
67
|
1 |
|
} |
|
68
|
2 |
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|