Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c4ccfac

Browse filesBrowse files
dunglasfabpot
authored andcommitted
[FrameworkBundle] Fix Templating Engine autowiring
1 parent fa01e84 commit c4ccfac
Copy full SHA for c4ccfac

File tree

4 files changed

+11
-9
lines changed
Filter options

4 files changed

+11
-9
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/TemplatingPass.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as FrameworkBundleEngineInterface;
1415
use Symfony\Component\DependencyInjection\ContainerBuilder;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17+
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;
1618

1719
class TemplatingPass implements CompilerPassInterface
1820
{
@@ -22,6 +24,11 @@ public function process(ContainerBuilder $container)
2224
return;
2325
}
2426

27+
if ($container->hasAlias('templating')) {
28+
$definition = $container->findDefinition('templating');
29+
$definition->setAutowiringTypes(array(ComponentEngineInterface::class, FrameworkBundleEngineInterface::class));
30+
}
31+
2532
if ($container->hasDefinition('templating.engine.php')) {
2633
$helpers = array();
2734
foreach ($container->findTaggedServiceIds('templating.helper') as $id => $attributes) {

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<service id="templating.engine.delegating" class="Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine" public="false">
99
<argument type="service" id="service_container" />
1010
<argument type="collection" /> <!-- engines -->
11-
12-
<autowiring-type>Symfony\Component\Templating\EngineInterface</autowiring-type>
13-
<autowiring-type>Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type>
1411
</service>
1512

1613
<service id="templating.name_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser">

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
use Doctrine\Common\Annotations\AnnotationReader;
1515
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;
1718

1819
class AutowiringTypesTest extends WebTestCase
1920
{
@@ -41,8 +42,8 @@ public function testTemplatingAutowiring()
4142
$container = static::$kernel->getContainer();
4243

4344
$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());
4647
}
4748

4849
protected static function createKernel(array $options = array())

‎src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
<argument type="service" id="twig" />
6060
<argument type="service" id="templating.name_parser" />
6161
<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>
6562
</service>
6663

6764
<service id="twig.extension.profiler" class="Symfony\Bridge\Twig\Extension\ProfilerExtension" public="false">

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.