8000 bug #26275 Set controller without __invoke method from invokable clas… · symfony/symfony@52af59f · GitHub
[go: up one dir, main page]

Skip to content

Commit 52af59f

Browse 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

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines 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