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

cc68c5074e Set controller without __invoke method from invokable class
This commit is contained in:
Fabien Potencier 2018-02-26 05:28:34 +01:00
commit 52af59fd48

View File

@ -29,7 +29,11 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader
*/
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
{
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
if ('__invoke' === $method->getName()) {
$route->setDefault('_controller', $class->getName());
} else {
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
}
}
/**