-
Notifications
You must be signed in to change notification settings - Fork 9
/
AsmTranslationLoaderBundle.php
52 lines (48 loc) · 1.92 KB
/
AsmTranslationLoaderBundle.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
<?php
/*
* This file is part of the AsmTranslationLoaderBundle package.
*
* (c) Marc Aschmann <maschmann@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Asm\TranslationLoaderBundle;
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\AddResourcePass;
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\LegacyRegisterListenersPass;
use Asm\TranslationLoaderBundle\DependencyInjection\Compiler\RegisterFileLoadersPass;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass;
/**
* Class AsmTranslationLoaderBundle
*
* @package Asm\TranslationLoaderBundle
* @author Marc Aschmann <maschmann@gmail.com>
*/
class AsmTranslationLoaderBundle extends Bundle
{
/**
* {@inheritDoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new AddResourcePass());
$container->addCompilerPass(new RegisterFileLoadersPass());
if (class_exists('Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass')) {
$container->addCompilerPass(new RegisterListenersPass(
'asm_translation_loader.event_dispatcher',
'asm_translation_loader.event_listener',
'asm_translation_loader.event_subscriber'
), PassConfig::TYPE_BEFORE_REMOVING);
} else {
$container->addCompilerPass(new LegacyRegisterListenersPass(
'asm_translation_loader.event_dispatcher',
'asm_translation_loader.event_listener',
'asm_translation_loader.event_subscriber'
), PassConfig::TYPE_BEFORE_REMOVING);
}
}
}