Completed
Push — master ( 83935c...581c97 )
by
12:38
created

DoSQueueExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBundleConfiguration() 0 4 1
B prepend() 0 29 1
1
<?php
2
3
namespace DoS\QueueBundle\DependencyInjection;
4
5
use DoS\CernelBundle\Config\AbstractExtension;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
8
9
class DoSQueueExtension extends AbstractExtension implements PrependExtensionInterface
10
{
11
    protected $applicationName = 'dos';
12
13
    /**
14
     * {@inheritdoc}
15
     */
16
    protected function getBundleConfiguration()
17
    {
18
        return new Configuration();
19
    }
20
21
    /**
22
     * @inheritDoc
23
     */
24
    public function prepend(ContainerBuilder $container)
25
    {
26
        $config = $container->getExtensionConfig($this->getAlias());
27
        $config = $this->processConfiguration($this->getBundleConfiguration(), $config);
28
29
        // TODO: duplicate new connection.
30
        $container->prependExtensionConfig('doctrine', array(
31
            'orm' => array(
32
                'entity_managers' => array(
33
                    $config['object_manager'] => array(
34
                        'connection' => $config['connection'],
35
                        'mappings' => array(
36
                            'DoSQueueBundle' => array(
37
                                'type' => 'yml',
38
                                'prefix' => 'DoS\QueueBundle\Model',
39
                                'dir' => '%kernel.root_dir%/../vendor/liverbool/dos-queue-bundle/Resources/config/doctrine/model',
40
                            )
41
                        ),
42
                        'filters' => array(
43
                            'softdeleteable' => array(
44
                                'class' => 'Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter',
45
                                'enabled' => true,
46
                            ),
47
                        ),
48
                    )
49
                )
50
            ),
51
        ));
52
    }
53
}
54