Completed
Pull Request — 3.x (#246)
by
unknown
01:40
created

MongoDBMappingCompilerPass::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\NotificationBundle\DependencyInjection\Compiler;
13
14
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
15
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
18
/**
19
 * @author Salma Chakroun <[email protected]>
20
 */
21
class MongoDBMappingCompilerPass implements CompilerPassInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function process(ContainerBuilder $container)
27
    {
28
        $modelDir = realpath(__DIR__.'/../../Resources/config/doctrine');
29
        $mappings = array(
30
            $modelDir => 'Sonata\NotificationBundle\Document',
31
        );
32
33
        $container->addCompilerPass(
34
            DoctrineMongoDBMappingsPass::createXmlMappingDriver(
35
                $mappings, array('doctrine_mongodb.odm.default_document_manager')
36
            )
37
        );
38
    }
39
40
}
41