Code

< 40 %
40-60 %
> 60 %
1
<?php
2
3
namespace Tpg\ExtjsBundle;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\HttpKernel\Bundle\Bundle;
7
use JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass;
8
use Symfony\Component\DependencyInjection\Definition;
9
use Tpg\ExtjsBundle\DependencyInjection\SerializerParserPass;
10
11
class TpgExtjsBundle extends Bundle
12
{
13 1
    public function build(ContainerBuilder $builder)
14
    {
15
16 1
        parent::build($builder);
17
18 1
        $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.serialization_visitor', 'format',
19 View Code Duplication
            function(ContainerBuilder $container, Definition $def) {
20 1
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
21 1
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def);
22 1
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
23 1
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def);
24 1
            }
25 1
        ));
26 1
        $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.deserialization_visitor', 'format',
27 1 View Code Duplication
            function(ContainerBuilder $container, Definition $def) {
28 1
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
29 1
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def);
30 1
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
31 1
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def);
32 1
            }
33 1
        ));
34
35 1
        $builder->addCompilerPass(new SerializerParserPass());
36 1
    }
37
}
38