Skip to content

Commit

Permalink
bug #26275 Set controller without __invoke method from invokable clas…
Browse files Browse the repository at this point in the history
…s (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
  • Loading branch information
fabpot committed Feb 26, 2018
2 parents 84fd602 + cc68c50 commit 52af59f
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -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());
}
}

/**
Expand Down

0 comments on commit 52af59f

Please sign in to comment.