IvoazContentEditableBundle   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 34
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B build() 0 31 3
1
<?php
2
3
/*
4
 * This file is part of the Ivoaz ContentEditable bundle.
5
 *
6
 * (c) Ivo Azirjans <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Ivoaz\Bundle\ContentEditableBundle;
13
14
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
15
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\HttpKernel\Bundle\Bundle;
18
19
class IvoazContentEditableBundle extends Bundle
20
{
21
    public function build(ContainerBuilder $container)
22
    {
23
        parent::build($container);
24
25
        $modelDir = realpath(__DIR__.'/Resources/config/doctrine/model');
26
        $mappings = [$modelDir => 'Ivoaz\Bundle\ContentEditableBundle\Model'];
27
28
        $ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
29
        if (class_exists($ormCompilerClass)) {
30
            $container->addCompilerPass(
31
                DoctrineOrmMappingsPass::createXmlMappingDriver(
32
                    $mappings,
33
                    ['ivoaz_content_editable.model_manager_name'],
34
                    'ivoaz_content_editable.model_type_orm',
35
                    ['IvoazContentEditableBundle' => 'Symfony\Cmf\RoutingBundle\Model']
36
                )
37
            );
38
        }
39
40
        $mongoCompilerClass = 'Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass';
41
        if (class_exists($mongoCompilerClass)) {
42
            $container->addCompilerPass(
43
                DoctrineMongoDBMappingsPass::createXmlMappingDriver(
44
                    $mappings,
45
                    ['ivoaz_content_editable.model_manager_name'],
46
                    'ivoaz_content_editable.model_type_mongodb',
47
                    ['IvoazContentEditableBundle' => 'Symfony\Cmf\RoutingBundle\Model']
48
                )
49
            );
50
        }
51
    }
52
}
53