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 52af59f

Browse filesBrowse files
committed
bug #26275 Set controller without __invoke method from invokable class (Tobion)
This PR was merged into the 3.4 branch. Discussion ---------- Set controller without __invoke method from invokable class | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Fixes one part of #25103 Commits ------- cc68c50 Set controller without __invoke method from invokable class
2 parents 84fd602 + cc68c50 commit 52af59f
Copy full SHA for 52af59f

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader
2929
*/
3030
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
3131
{
32-
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
32+
if ('__invoke' === $method->getName()) {
33+
$route->setDefault('_controller', $class->getName());
34+
} else {
35+
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
36+
}
3337
}
3438

3539
/**

0 commit comments

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