bug #18320 [FrameworkBundle] Fix Templating Engine autowiring (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #18320).
Discussion
----------
[FrameworkBundle] Fix Templating Engine autowiring
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/18242#discussion_r57471337
| License | MIT
| Doc PR | n/a
Commits
-------
c4ccfac
[FrameworkBundle] Fix Templating Engine autowiring
This commit is contained in:
commit
f76e99b9f4
@ -11,8 +11,10 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as FrameworkBundleEngineInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface;
|
||||
|
||||
class TemplatingPass implements CompilerPassInterface
|
||||
{
|
||||
@ -22,6 +24,11 @@ class TemplatingPass implements CompilerPassInterface
|
||||
return;
|
||||
}
|
||||
|
||||
if ($container->hasAlias('templating')) {
|
||||
$definition = $container->findDefinition('templating');
|
||||
$definition->setAutowiringTypes(array(ComponentEngineInterface::class, FrameworkBundleEngineInterface::class));
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('templating.engine.php')) {
|
||||
$helpers = array();
|
||||
foreach ($container->findTaggedServiceIds('templating.helper') as $id => $attributes) {
|
||||
|
@ -8,9 +8,6 @@
|
||||
<service id="templating.engine.delegating" class="Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine" public="false">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument type="collection" /> <!-- engines -->
|
||||
|
||||
<autowiring-type>Symfony\Component\Templating\EngineInterface</autowiring-type>
|
||||
<autowiring-type>Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type>
|
||||
</service>
|
||||
|
||||
<service id="templating.name_parser" class="Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser">
|
||||
|
@ -13,7 +13,8 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\CachedReader;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as FrameworkBundleEngineInterface;
|
||||
|
||||
class AutowiringTypesTest extends WebTestCase
|
||||
{
|
||||
@ -41,8 +42,8 @@ class AutowiringTypesTest extends WebTestCase
|
||||
$container = static::$kernel->getContainer();
|
||||
|
||||
$autowiredServices = $container->get('test.autowiring_types.autowired_services');
|
||||
$this->assertInstanceOf(DelegatingEngine::class, $autowiredServices->getFrameworkBundleEngine());
|
||||
$this->assertInstanceOf(DelegatingEngine::class, $autowiredServices->getEngine());
|
||||
$this->assertInstanceOf(FrameworkBundleEngineInterface::class, $autowiredServices->getFrameworkBundleEngine());
|
||||
$this->assertInstanceOf(EngineInterface::class, $autowiredServices->getEngine());
|
||||
}
|
||||
|
||||
protected static function createKernel(array $options = array())
|
||||
|
@ -59,9 +59,6 @@
|
||||
<argument type="service" id="twig" />
|
||||
<argument type="service" id="templating.name_parser" />
|
||||
<argument type="service" id="templating.locator" />
|
||||
|
||||
<autowiring-type>Symfony\Component\Templating\EngineInterface</autowiring-type>
|
||||
<autowiring-type>Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type>
|
||||
</service>
|
||||
|
||||
<service id="twig.extension.profiler" class="Symfony\Bridge\Twig\Extension\ProfilerExtension" public="false">
|
||||
|
Reference in New Issue
Block a user