Completed
Push — orm ( df18d5 )
by
unknown
06:37
created

MajoraOAuthServerBundle::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Majora\Bundle\OAuthServerBundle;
4
5
use Symfony\Component\HttpKernel\Bundle\Bundle;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
8
9
class MajoraOAuthServerBundle extends Bundle
10
{
11
    protected $container;
12
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function getContainerExtension()
17
    {
18
        return $this->createContainerExtension();
19
    }
20
21
    /**
22
     * @param ContainerBuilder $container
23
     */
24
    public function build(ContainerBuilder $container)
25
    {
26
        $this->container = $container;
27
28
        $this->addMappingsPass();
29
    }
30
31
    /**
32
     * Add mappings.
33
     */
34
    private function addMappingsPass()
35
    {
36
        $ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
37
38
        $mappings = array(
39
            realpath(__DIR__.'/Resources/config/mapping/ORM') => 'Majora\Component\OAuth\Entity',
40
        );
41
42
        if (class_exists($ormCompilerClass)) {
43
            $this->container->addCompilerPass(DoctrineOrmMappingsPass::createYamlMappingDriver($mappings, array(), 'majora_oauth_server.driver.orm'));
44
        }
45
    }
46
}
47