|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Black\Bundle\PageBundle; |
|
4
|
|
|
|
|
5
|
|
|
use Black\Bundle\PageBundle\Application\DependencyInjection\BlackPageExtension; |
|
6
|
|
|
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; |
|
7
|
|
|
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass; |
|
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 BlackPageBundle |
|
15
|
|
|
*/ |
|
16
|
|
|
class BlackPageBundle extends Bundle |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* {@inheritdoc} |
|
20
|
|
|
*/ |
|
21
|
|
|
public function getContainerExtension() |
|
22
|
|
|
{ |
|
23
|
|
|
return new BlackPageExtension(); |
|
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/model') => 'Black\Page\Domain\Model', |
|
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
|
|
|
'black_page.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
|
|
|
'black_page.backend_type_mongodb' |
|
56
|
|
|
)); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* {@inheritdoc} |
|
62
|
|
|
*/ |
|
63
|
|
|
public function registerCommands(Application $application) |
|
64
|
|
|
{ |
|
65
|
|
|
return; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|