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

BlackPageBundle   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 52
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 4 1
B build() 0 30 3
A registerCommands() 0 4 1
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