DoctrineORMBridgeBundle::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 12
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorUser\DoctrineORMBridgeBundle;
14
15
use BenGorUser\DoctrineORMBridgeBundle\DependencyInjection\Compiler\DoctrineORMCustomTypesPass;
16
use BenGorUser\DoctrineORMBridgeBundle\DependencyInjection\Compiler\DoctrineORMServicesPass;
17
use BenGorUser\UserBundle\DependentBenGorUserBundle;
18
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
19
use Symfony\Component\DependencyInjection\ContainerBuilder;
20
use Symfony\Component\HttpKernel\Bundle\Bundle;
21
22
/**
23
 * Doctrine ORM bridge bundle kernel class.
24
 *
25
 * @author Beñat Espiña <[email protected]>
26
 */
27
class DoctrineORMBridgeBundle extends Bundle
28
{
29
    use DependentBenGorUserBundle;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function build(ContainerBuilder $container)
35
    {
36
        $this->checkDependencies(['BenGorUserBundle', 'DoctrineBundle'], $container);
37
38
        $container
39
            ->addCompilerPass(new DoctrineORMCustomTypesPass(), PassConfig::TYPE_OPTIMIZE)
40
            ->addCompilerPass(new DoctrineORMServicesPass(), PassConfig::TYPE_OPTIMIZE);
41
42
        $container->loadFromExtension('doctrine', [
43
            'orm' => [
44
                'mappings' => [
45
                    'DoctrineORMBridgeBundle' => [
46
                        'type'      => 'yml',
47
                        'is_bundle' => true,
48
                        'prefix'    => 'BenGorUser\\User\\Domain\\Model',
49
                    ],
50
                ],
51
            ],
52
        ]);
53
    }
54
}
55