-
Notifications
You must be signed in to change notification settings - Fork 0
/
Numerique1NotificationBundle.php
37 lines (31 loc) · 1.45 KB
/
Numerique1NotificationBundle.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
<?php
namespace Numerique1\Bundle\NotificationBundle;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Numerique1\Bundle\NotificationBundle\DependencyInjection\Compiler\EventsCompilerPass;
use Numerique1\Bundle\NotificationBundle\DependencyInjection\Compiler\NotifiablesResolverCompilerPass;
use Numerique1\Bundle\NotificationBundle\DependencyInjection\Compiler\TemplateResolverCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class Numerique1NotificationBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new NotifiablesResolverCompilerPass());
$container->addCompilerPass(new TemplateResolverCompilerPass());
$container->addCompilerPass(new EventsCompilerPass());
$this->addRegisterMappingsPass($container);
}
/**
* @param ContainerBuilder $container
*/
private function addRegisterMappingsPass(ContainerBuilder $container)
{
$mappings = array(
realpath(__DIR__ . '/Resources/config/ORM') => 'Numerique1\Bundle\NotificationBundle\Model',
);
if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) {
$container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings));
}
}
}