forked from Aerendir/bundle-aws-ses-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AwsSesMonitorBundle.php
57 lines (50 loc) · 1.54 KB
/
AwsSesMonitorBundle.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
53
54
55
56
57
<?php
/*
* This file is part of the AWS SES Monitor Bundle.
*
* @author Adamo Aerendir Crespi <[email protected]>
* @author Audrius Karabanovas <[email protected]>
*/
namespace SerendipityHQ\Bundle\AwsSesMonitorBundle;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* {@inheritdoc}
*
* @codeCoverageIgnore
*/
class AwsSesMonitorBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
$modelDir = realpath(__DIR__ . '/Resources/config/doctrine/mappings');
$mappings = [
$modelDir => 'SerendipityHQ\Bundle\AwsSesMonitorBundle\Model',
];
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
if (class_exists($ormCompilerClass)) {
$container->addCompilerPass(
$this->getXmlMappingDriver($mappings)
);
}
}
/**
* @param array $mappings
*
* @return DoctrineOrmMappingsPass
*/
private function getXmlMappingDriver(array $mappings)
{
return DoctrineOrmMappingsPass::createXmlMappingDriver(
$mappings,
['aws_ses_monitor.model_manager_name'],
'aws_ses_monitor.backend_orm',
['AwsSesMonitorBundle' => 'SerendipityHQ\Bundle\AwsSesMonitorBundle\Model']
);
}
}