forked from LerochkaKapito/extjs-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TpgExtjsBundle.php
41 lines (35 loc) · 1.95 KB
/
TpgExtjsBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Tpg\ExtjsBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass;
use Symfony\Component\DependencyInjection\Definition;
use Tpg\ExtjsBundle\DependencyInjection\SerializerParserPass;
class TpgExtjsBundle extends Bundle
{
public function build(ContainerBuilder $builder)
{
parent::build($builder);
$builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.serialization_visitor', 'format',
function(ContainerBuilder $container, Definition $def) {
if ($container->hasDefinition("tpg_extjs.orm_serializer"))
$container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def);
if ($container->hasDefinition("tpg_extjs.odm_serializer"))
$container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def);
if ($container->hasDefinition("tpg_extjs.phpcr_serializer"))
$container->getDefinition('tpg_extjs.phpcr_serializer')->replaceArgument(3, $def);
}
));
$builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.deserialization_visitor', 'format',
function(ContainerBuilder $container, Definition $def) {
if ($container->hasDefinition("tpg_extjs.orm_serializer"))
$container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def);
if ($container->hasDefinition("tpg_extjs.odm_serializer"))
$container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def);
if ($container->hasDefinition("tpg_extjs.phpcr_serializer"))
$container->getDefinition('tpg_extjs.phpcr_serializer')->replaceArgument(4, $def);
}
));
$builder->addCompilerPass(new SerializerParserPass());
}
}