[FrameworkBundle] Move identity translator configuration to PHP

This commit is contained in:
Sagrario Meneses 2020-06-11 10:52:34 -05:00
parent 3c5f9d1c8c
commit 335c9dba71
3 changed files with 26 additions and 15 deletions

View File

@ -213,7 +213,7 @@ class FrameworkExtension extends Extension
}
if (class_exists(Translator::class)) {
$loader->load('identity_translator.xml');
$phpLoader->load('identity_translator.php');
}
}

View File

@ -0,0 +1,25 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\Translation\IdentityTranslator;
use Symfony\Contracts\Translation\TranslatorInterface;
return static function (ContainerConfigurator $container) {
$container->services()
->set('translator', IdentityTranslator::class)
->public()
->alias(TranslatorInterface::class, 'translator')
->set('identity_translator', IdentityTranslator::class)
;
};

View File

@ -1,14 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<defaults public="false" />
<service id="translator" class="Symfony\Component\Translation\IdentityTranslator" public="true" />
<service id="Symfony\Contracts\Translation\TranslatorInterface" alias="translator" />
<service id="identity_translator" class="Symfony\Component\Translation\IdentityTranslator" />
</services>
</container>