Passed
Branch master (4407aa)
by ANTHONIUS
02:45
created

DoyoUserBundle   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 26
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 4 1
A addRegisterMappingPass() 0 18 4
1
<?php
2
3
/*
4
 * This file is part of the DoyoUserBundle project.
5
 *
6
 * (c) Anthonius Munthi <[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
declare(strict_types=1);
13
14
namespace Doyo\UserBundle;
15
16
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\HttpKernel\Bundle\Bundle;
19
20
class DoyoUserBundle extends Bundle
21
{
22
    public function build(ContainerBuilder $container)
23
    {
24
        parent::build($container);
25
        $this->addRegisterMappingPass($container);
26
    }
27
28
    private function addRegisterMappingPass(ContainerBuilder $container)
29
    {
30
        $mappings = array(
31
            realpath(__DIR__.'/Resources/config/doctrine-mapping') => 'Doyo\UserBundle\Model',
32
        );
33
34
        if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) {
35
            $container->addCompilerPass(
36
                DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, array('doyo_user.model_manager_name'), 'doyo_user.backend_type_orm')
37
            );
38
        }
39
40
        if (class_exists('Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass')) {
41
            $container->addCompilerPass(DoctrineMongoDBMappingsPass::createXmlMappingDriver($mappings, array('doyo_user.model_manager_name'), 'doyo_user.backend_type_mongodb'));
0 ignored issues
show
Bug introduced by
The type Doyo\UserBundle\DoctrineMongoDBMappingsPass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
        }
43
44
        if (class_exists('Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\DoctrineCouchDBMappingsPass')) {
45
            $container->addCompilerPass(DoctrineCouchDBMappingsPass::createXmlMappingDriver($mappings, array('doyo_user.model_manager_name'), 'doyo_user.backend_type_couchdb'));
0 ignored issues
show
Bug introduced by
The type Doyo\UserBundle\DoctrineCouchDBMappingsPass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
46
        }
47
    }
48
}
49