File tree 4 files changed +11
-9
lines changed
DependencyInjection/Compiler
TwigBundle/Resources/config
4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Bundle \FrameworkBundle \DependencyInjection \Compiler ;
13
13
14
+ use Symfony \Bundle \FrameworkBundle \Templating \EngineInterface as FrameworkBundleEngineInterface ;
14
15
use Symfony \Component \DependencyInjection \ContainerBuilder ;
15
16
use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17
+ use Symfony \Component \Templating \EngineInterface as ComponentEngineInterface ;
16
18
17
19
class TemplatingPass implements CompilerPassInterface
18
20
{
@@ -22,6 +24,11 @@ public function process(ContainerBuilder $container)
22
24
return ;
23
25
}
24
26
27
+ if ($ container ->hasAlias ('templating ' )) {
28
+ $ definition = $ container ->findDefinition ('templating ' );
29
+ $ definition ->setAutowiringTypes (array (ComponentEngineInterface::class, FrameworkBundleEngineInterface::class));
30
+ }
31
+
25
32
if ($ container ->hasDefinition ('templating.engine.php ' )) {
26
33
$ helpers = array ();
27
34
foreach ($ container ->findTaggedServiceIds ('templating.helper ' ) as $ id => $ attributes ) {
Original file line number Diff line number Diff line change 8
8
<service id =" templating.engine.delegating" class =" Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine" public =" false" >
9
9
<argument type =" service" id =" service_container" />
10
10
<argument type =" collection" /> <!-- engines -->
11
-
12
- <autowiring-type >Symfony\Component\Templating\EngineInterface</autowiring-type >
13
- <autowiring-type >Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type >
14
11
</service >
15
12
16
13
<service id =" templating.name_parser" class =" Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser" >
Original file line number Diff line number Diff line change 13
13
14
14
use Doctrine \Common \Annotations \AnnotationReader ;
15
15
use Doctrine \Common \Annotations \CachedReader ;
16
- use Symfony \Bundle \FrameworkBundle \Templating \DelegatingEngine ;
16
+ use Symfony \Component \Templating \EngineInterface ;
17
+ use Symfony \Bundle \FrameworkBundle \Templating \EngineInterface as FrameworkBundleEngineInterface ;
17
18
18
19
class AutowiringTypesTest extends WebTestCase
19
20
{
@@ -41,8 +42,8 @@ public function testTemplatingAutowiring()
41
42
$ container = static ::$ kernel ->getContainer ();
42
43
43
44
$ autowiredServices = $ container ->get ('test.autowiring_types.autowired_services ' );
44
- $ this ->assertInstanceOf (DelegatingEngine ::class, $ autowiredServices ->getFrameworkBundleEngine ());
45
- $ this ->assertInstanceOf (DelegatingEngine ::class, $ autowiredServices ->getEngine ());
45
+ $ this ->assertInstanceOf (FrameworkBundleEngineInterface ::class, $ autowiredServices ->getFrameworkBundleEngine ());
46
+ $ this ->assertInstanceOf (EngineInterface ::class, $ autowiredServices ->getEngine ());
46
47
}
47
48
48
49
protected static function createKernel (array $ options = array ())
Original file line number Diff line number Diff line change 59
59
<argument type =" service" id =" twig" />
60
60
<argument type =" service" id =" templating.name_parser" />
61
61
<argument type =" service" id =" templating.locator" />
62
-
63
- <autowiring-type >Symfony\Component\Templating\EngineInterface</autowiring-type >
64
- <autowiring-type >Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type >
65
62
</service >
66
63
67
64
<service id =" twig.extension.profiler" class =" Symfony\Bridge\Twig\Extension\ProfilerExtension" public =" false" >
You can’t perform that action at this time.
0 commit comments