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

QueryManagerCompilerPass::process()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 7
nc 4
nop 1
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