|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the AsmTranslationLoaderBundle package. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Marc Aschmann <[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 Asm\TranslationLoaderBundle; |
|
11
|
|
|
|
|
12
|
|
|
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\AddResourcePass; |
|
13
|
|
|
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\LegacyRegisterListenersPass; |
|
14
|
|
|
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\RegisterFileLoadersPass; |
|
15
|
|
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
17
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
18
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Class AsmTranslationLoaderBundle |
|
22
|
|
|
* |
|
23
|
|
|
* @package Asm\TranslationLoaderBundle |
|
24
|
|
|
* @author Marc Aschmann <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class AsmTranslationLoaderBundle extends Bundle |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritDoc} |
|
30
|
|
|
*/ |
|
31
|
|
|
public function build(ContainerBuilder $container) |
|
32
|
|
|
{ |
|
33
|
|
|
parent::build($container); |
|
34
|
|
|
|
|
35
|
|
|
$container->addCompilerPass(new AddResourcePass()); |
|
36
|
|
|
$container->addCompilerPass(new RegisterFileLoadersPass()); |
|
37
|
|
|
|
|
38
|
|
|
if (class_exists('Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass')) { |
|
39
|
|
|
$container->addCompilerPass(new RegisterListenersPass( |
|
40
|
|
|
'asm_translation_loader.event_dispatcher', |
|
41
|
|
|
'asm_translation_loader.event_listener', |
|
42
|
|
|
'asm_translation_loader.event_subscriber' |
|
43
|
|
|
), PassConfig::TYPE_BEFORE_REMOVING); |
|
44
|
|
|
} else { |
|
45
|
|
|
$container->addCompilerPass(new LegacyRegisterListenersPass( |
|
46
|
|
|
'asm_translation_loader.event_dispatcher', |
|
47
|
|
|
'asm_translation_loader.event_listener', |
|
48
|
|
|
'asm_translation_loader.event_subscriber' |
|
49
|
|
|
), PassConfig::TYPE_BEFORE_REMOVING); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|