Skip to content

Commit 571e0ee

Browse files
dangkhoagmsTobion
authored andcommitted
[request] Move configuration to PHP
1 parent d132942 commit 571e0ee

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
282282
}
283283

284284
if ($this->isConfigEnabled($container, $config['request'])) {
285-
$this->registerRequestConfiguration($config['request'], $container, $loader);
285+
$this->registerRequestConfiguration($config['request'], $container, $phpLoader);
286286
}
287287

288288
if (null === $config['csrf_protection']['enabled']) {
@@ -980,10 +980,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
980980
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
981981
}
982982

983-
private function registerRequestConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
983+
private function registerRequestConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
984984
{
985985
if ($config['formats']) {
986-
$loader->load('request.xml');
986+
$loader->load('request.php');
987987

988988
$listener = $container->getDefinition('request.add_request_formats_listener');
989989
$listener->replaceArgument(0, $config['formats']);

Resources/config/request.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
15+
16+
return static function (ContainerConfigurator $container) {
17+
$container->services()
18+
->set('request.add_request_formats_listener', AddRequestFormatsListener::class)
19+
->args([abstract_arg('formats')])
20+
->tag('kernel.event_subscriber')
21+
;
22+
};

Resources/config/request.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)