Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #23239 [FrameworkBundle] call setContainer() for autowired contro…
…llers (xabbuh) This PR was merged into the 3.3 branch. Discussion ---------- [FrameworkBundle] call setContainer() for autowired controllers | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23200, FriendsOfSymfony/FOSRestBundle#1719 | License | MIT | Doc PR | Previously, you either did not use controllers as services or you explicitly wired everything yourself. In case of a non-service controller the FrameworkBundle took care of calling `setContainer()` inside the `instantiateController()` method: ```php protected function instantiateController($class) { $controller = parent::instantiateController($class); if ($controller instanceof ContainerAwareInterface) { $controller->setContainer($this->container); } if ($controller instanceof AbstractController && null !== $previousContainer = $controller->setContainer($this->container)) { $controller->setContainer($previousContainer); } return $controller; } ``` With the new autowired controllers as services this is no longer happening as controllers do not need to be instantiated anymore (the container already returns fully built objects). Commits ------- 1d07a28 call setContainer() for autowired controllers
- Loading branch information
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters