Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit faafec4

Browse filesBrowse files
committed
bug #37044 [DependencyInjection] Apply ExpressionLanguageProviderPass to router.default (wizhippo)
This PR was squashed before being merged into the 5.1 branch. Discussion ---------- [DependencyInjection] Apply ExpressionLanguageProviderPass to router.default | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37042 | License | MIT Using a `chain_router` usually replaces the `router` and add the `router.default` to it's chain. This would `addExpressionLanguageProvider` to the default router only as the chain router is not expected to have `addExpressionLanguageProvider` as it is not part of the router interface. Commits ------- 215ad1f [DependencyInjection] Apply ExpressionLanguageProviderPass to router.default
2 parents 69c37c0 + 215ad1f commit faafec4
Copy full SHA for faafec4

File tree

2 files changed

+7
-7
lines changed
Filter options

2 files changed

+7
-7
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class AddExpressionLanguageProvidersPass implements CompilerPassInterface
2828
public function process(ContainerBuilder $container)
2929
{
3030
// routing
31-
if ($container->has('router')) {
32-
$definition = $container->findDefinition('router');
31+
if ($container->has('router.default')) {
32+
$definition = $container->findDefinition('router.default');
3333
foreach ($container->findTaggedServiceIds('routing.expression_language_provider', true) as $id => $attributes) {
3434
$definition->addMethodCall('addExpressionLanguageProvider', [new Reference($id)]);
3535
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddExpressionLanguageProvidersPassTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ class AddExpressionLanguageProvidersPassTest extends TestCase
2222
public function testProcessForRouter()
2323
{
2424
$container = new ContainerBuilder();
25-
$container->addCompilerPass(new AddExpressionLanguageProvidersPass(false));
25+
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
2626

2727
$definition = new Definition('\stdClass');
2828
$definition->addTag('routing.expression_language_provider');
2929
$container->setDefinition('some_routing_provider', $definition->setPublic(true));
3030

31-
$container->register('router', '\stdClass')->setPublic(true);
31+
$container->register('router.default', '\stdClass')->setPublic(true);
3232
$container->compile();
3333

34-
$router = $container->getDefinition('router');
34+
$router = $container->getDefinition('router.default');
3535
$calls = $router->getMethodCalls();
3636
$this->assertCount(1, $calls);
3737
$this->assertEquals('addExpressionLanguageProvider', $calls[0][0]);
@@ -41,14 +41,14 @@ public function testProcessForRouter()
4141
public function testProcessForRouterAlias()
4242
{
4343
$container = new ContainerBuilder();
44-
$container->addCompilerPass(new AddExpressionLanguageProvidersPass(false));
44+
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
4545

4646
$definition = new Definition('\stdClass');
4747
$definition->addTag('routing.expression_language_provider');
4848
$container->setDefinition('some_routing_provider', $definition->setPublic(true));
4949

5050
$container->register('my_router', '\stdClass')->setPublic(true);
51-
$container->setAlias('router', 'my_router');
51+
$container->setAlias('router.default', 'my_router');
5252
$container->compile();
5353

5454
$router = $container->getDefinition('my_router');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.