Completed
Pull Request — master (#81)
by
unknown
28:56
created

QueryManagerCompilerPass   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 13 5
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class QueryManagerCompilerPass implements CompilerPassInterface
10
{
11
    /**
12
     * @param ContainerBuilder $container
13
     */
14
    public function process(ContainerBuilder $container)
15
    {
16
        if ($container->has('ez_migration_bundle.executor.query_manager') && $container->has('ez_migration_bundle.migration_service')) {
17
            $queryManagerDefinition = $container->findDefinition('ez_migration_bundle.executor.query_manager');
18
            $migrationServiceDefinition = $container->findDefinition('ez_migration_bundle.migration_service');
19
20
            foreach ($migrationServiceDefinition->getMethodCalls() as $methodCall) {
21
                if ($methodCall[0] === 'addExecutor') {
22
                    $queryManagerDefinition->addMethodCall($methodCall[0], $methodCall[1]);
23
                }
24
            }
25
        }
26
    }
27
}
28