DoctrineODMMongoDBBridgeBundle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 5
dl 0
loc 40
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A build() 0 20 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\DoctrineODMMongoDBBridgeBundle;
14
15
use BenGorUser\DoctrineODMMongoDBBridge\Infrastructure\Persistence\Types\UserEmailType;
16
use BenGorUser\DoctrineODMMongoDBBridge\Infrastructure\Persistence\Types\UserIdType;
17
use BenGorUser\DoctrineODMMongoDBBridge\Infrastructure\Persistence\Types\UserPasswordType;
18
use BenGorUser\DoctrineODMMongoDBBridge\Infrastructure\Persistence\Types\UserRolesType;
19
use BenGorUser\DoctrineODMMongoDBBridge\Infrastructure\Persistence\Types\UserTokenType;
20
use BenGorUser\DoctrineODMMongoDBBridgeBundle\DependencyInjection\Compiler\DoctrineODMMongoDBServicesPass;
21
use BenGorUser\UserBundle\DependentBenGorUserBundle;
22
use Doctrine\ODM\MongoDB\Types\Type;
23
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
24
use Symfony\Component\DependencyInjection\ContainerBuilder;
25
use Symfony\Component\HttpKernel\Bundle\Bundle;
26
27
/**
28
 * Doctrine ODM MongoDB bridge bundle kernel class.
29
 *
30
 * @author Beñat Espiña <[email protected]>
31
 */
32
class DoctrineODMMongoDBBridgeBundle extends Bundle
33
{
34
    use DependentBenGorUserBundle;
35
36
    /**
37
     * Constructor.
38
     */
39
    public function __construct()
40
    {
41
        Type::registerType('user_email', UserEmailType::class);
42
        Type::registerType('user_id', UserIdType::class);
43
        Type::registerType('user_password', UserPasswordType::class);
44
        Type::registerType('user_roles', UserRolesType::class);
45
        Type::registerType('user_token', UserTokenType::class);
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function build(ContainerBuilder $container)
52
    {
53
        $this->checkDependencies(['BenGorUserBundle', 'DoctrineMongoDBBundle'], $container);
54
55
        $container->addCompilerPass(new DoctrineODMMongoDBServicesPass(), PassConfig::TYPE_OPTIMIZE);
56
57
        $container->loadFromExtension('doctrine_mongodb', [
58
            'document_managers' => [
59
                'default' => [
60
                    'mappings' => [
61
                        'DoctrineODMMongoDBBridgeBundle' => [
62
                            'type'      => 'yml',
63
                            'is_bundle' => true,
64
                            'prefix'    => 'BenGorUser\\User\\Domain\\Model',
65
                        ],
66
                    ],
67
                ],
68
            ],
69
        ]);
70
    }
71
}
72