Completed
Push — feature/rewrite ( 88e863...f6b662 )
by Alexandre
01:55
created

BlackPageBundle::getContainerExtension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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