This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Controller
Fabien Potencier f9b0aaa488 bug #18289 [FrameworkBundle] Return the invokable service if its name is the class name (dunglas)
This PR was squashed before being merged into the 3.1-dev branch (closes #18289).

Discussion
----------

[FrameworkBundle] Return the invokable service if its name is the class name

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

 if a service is invokable and has the same name than its class name, the controller resolver of FrameworkBundle doesn't retrieve the service and tries to construct a new instance of the class instead.

This is a very rare edge case, but this fix is useful for dunglas/DunglasActionBundle#36: referencing auto-registered controllers following the ADR style in YAML and XML routing files will be more intuitive.

Currently: `defaults:  { _controller: 'Your\Action\FQN:__invoke' }`, after this fix: `defaults:  { _controller: 'Your\Action\FQN' }`.

This PR also fix a currently useless test.

Commits
-------

70b9309 [FrameworkBundle] Return the invokable service if its name is the class name
2016-03-25 18:28:09 +01:00
..
Controller.php Add a Controller function to make it easy to return json 2016-03-02 16:31:41 +02:00
ControllerNameParser.php fixes CS 2015-08-24 09:13:45 +02:00
ControllerResolver.php [FrameworkBundle] Return the invokable service if its name is the class name 2016-03-25 18:28:04 +01:00
RedirectController.php Remove abstract class and use Interface+Trait 2015-11-04 18:03:42 +01:00
TemplateController.php Remove abstract class and use Interface+Trait 2015-11-04 18:03:42 +01:00