4
4
5
5
use Symfony \Component \DependencyInjection \ContainerBuilder ;
6
6
use Symfony \Component \Config \FileLocator ;
7
+ use Symfony \Component \DependencyInjection \ContainerInterface ;
7
8
use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
8
9
use Symfony \Component \DependencyInjection \Loader ;
10
+ use Symfony \Component \HttpKernel \Kernel ;
9
11
10
12
/**
11
13
* This is the class that loads and manages your bundle configuration
@@ -28,6 +30,7 @@ public function load(array $configs, ContainerBuilder $container)
28
30
$ loader = new Loader \YamlFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
29
31
$ loader ->load ('services.yml ' );
30
32
33
+ $ this ->setSharedServices ($ container );
31
34
$ this ->loadCountryPostalCodeOverrides ($ config , $ container );
32
35
}
33
36
@@ -61,4 +64,18 @@ private function loadRequireStrictRegions(array $config, ContainerBuilder $conta
61
64
{
62
65
$ container ->setParameter ('markup_addressing.require_strict_regions ' , $ config ['require_strict_regions ' ]);
63
66
}
67
+
68
+ private function setSharedServices (ContainerBuilder $ container )
69
+ {
70
+ $ sharedServiceIds = ['markup_addressing.twig.internal ' ];
71
+ $ isLegacy = version_compare (Kernel::VERSION , '2.8 ' , '< ' );
72
+ foreach ($ sharedServiceIds as $ sharedServiceId ) {
73
+ $ definition = $ container ->getDefinition ($ sharedServiceId );
74
+ if (!$ isLegacy ) {
75
+ $ definition ->setShared (true );
76
+ } else {
77
+ $ definition ->setScope (ContainerInterface::SCOPE_PROTOTYPE , false );
78
+ }
79
+ }
80
+ }
64
81
}
0 commit comments