8000 [request] Move configuration to PHP by dangkhoagms · Pull Request #37287 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[request] Move configuration to PHP #37287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
}

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

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

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

$listener = $container->getDefinition('request.add_request_formats_listener');
$listener->replaceArgument(0, $config['formats']);
Expand Down
22 changes: 22 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/request.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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\HttpKernel\EventListener\AddRequestFormatsListener;

return static function (ContainerConfigurator $container) {
$container->services()
->set('request.add_request_formats_listener', AddRequestFormatsListener::class)
->args([abstract_arg('formats')])
->tag('kernel.event_subscriber')
;
};
15 changes: 0 additions & 15 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml

This file was deleted.

0