1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Black\Bundle\EmailBundle; |
4
|
|
|
|
5
|
|
|
use Black\Bundle\EmailBundle\Application\DependencyInjection\BlackEmailExtension; |
6
|
|
|
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass; |
7
|
|
|
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; |
8
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
9
|
|
|
use Symfony\Component\Finder\Finder; |
10
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
11
|
|
|
use Symfony\Component\Console\Application; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class BlackEmailBundle |
15
|
|
|
*/ |
16
|
|
|
class BlackEmailBundle extends Bundle |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @return BlackEmailExtension |
20
|
|
|
*/ |
21
|
|
|
public function getContainerExtension() |
22
|
|
|
{ |
23
|
|
|
return new BlackEmailExtension(); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param ContainerBuilder $container |
28
|
|
|
*/ |
29
|
|
|
public function build(ContainerBuilder $container) |
30
|
|
|
{ |
31
|
|
|
parent::build($container); |
32
|
|
|
|
33
|
|
|
$mappings = array( |
34
|
|
|
realpath($this->getPath() . '/Resources/config/doctrine/email') => 'Email', |
35
|
|
|
); |
36
|
|
|
|
37
|
|
|
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass'; |
38
|
|
|
|
39
|
|
|
if (class_exists($ormCompilerClass)) { |
40
|
|
|
$container->addCompilerPass( |
41
|
|
|
DoctrineOrmMappingsPass::createXmlMappingDriver( |
42
|
|
|
$mappings, |
43
|
|
|
[], |
44
|
|
|
'application.backend_type_orm' |
45
|
|
|
)); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
$mongoCompilerClass = 'Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass'; |
49
|
|
|
|
50
|
|
|
if (class_exists($mongoCompilerClass)) { |
51
|
|
|
$container->addCompilerPass( |
52
|
|
|
DoctrineMongoDBMappingsPass::createXmlMappingDriver( |
53
|
|
|
$mappings, |
54
|
|
|
[], |
55
|
|
|
'application.backend_type_mongodb' |
56
|
|
|
)); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* {@inheritdoc} |
62
|
|
|
*/ |
63
|
|
|
public function registerCommands(Application $application) |
64
|
|
|
{ |
65
|
|
|
return; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|