8000 minor #37225 [SecurityBundle] convert templating configuration to PHP… · JudicaelR/symfony@c0a3a64 · GitHub
[go: up one dir, main page]

Skip to content

Commit c0a3a64

Browse files
committed
minor symfony#37225 [SecurityBundle] convert templating configuration to PHP (ck-developer)
This PR was merged into the 5.2-dev branch. Discussion ---------- [SecurityBundle] convert templating configuration to PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Ref symfony#37186 | License | MIT Commits ------- 0c36a4b [SecurityBundle] convert templating configuration to PHP
2 parents 1d84e8b + 0c36a4b commit c0a3a64

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Symfony\Component\DependencyInjection\ContainerBuilder;
3030
use Symfony\Component\DependencyInjection\Definition;
3131
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
32+
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
3233
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
3334
use Symfony\Component\DependencyInjection\Reference;
3435
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -106,6 +107,9 @@ public function load(array $configs, ContainerBuilder $container)
106107

107108
// load services
108109
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
110+
111+
$phpLoader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
112+
109113
$loader->load('security.xml');
110114
$loader->load('security_listeners.xml');
111115
$loader->load('security_rememberme.xml');
@@ -128,7 +132,7 @@ public function load(array $configs, ContainerBuilder $container)
128132
}
129133

130134
if (class_exists(AbstractExtension::class)) {
131-
$loader->load('templating_twig.xml');
135+
$phpLoader->load('templating_twig.php');
132136
}
133137

134138
$loader->load('collectors.xml');
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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\Bridge\Twig\Extension\LogoutUrlExtension;
15+
use Symfony\Bridge\Twig\Extension\SecurityExtension;
16+
17+
return static function (ContainerConfigurator $container) {
18+
$container->services()
19+
->set('twig.extension.logout_url', LogoutUrlExtension::class)
20+
->args([
21+
service('security.logout_url_generator'),
22+
])
23+
->tag('twig.extension')
24+
25+
->set('twig.extension.security', SecurityExtension::class)
26+
->args([
27+
service('security.authorization_checker')->ignoreOnInvalid(),
28+
])
29+
->tag('twig.extension')
30+
;
31+
};

src/Symfony/Bundle/SecurityBundle/Resources/config/templating_twig.xml

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

0 commit comments

Comments
 (0)
0