Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42f2f92

Browse filesBrowse files
committed
Clarify goals of AbstractController
1 parent 8e984fa commit 42f2f92
Copy full SHA for 42f2f92

File tree

3 files changed

+11
-1
lines changed
Filter options

3 files changed

+11
-1
lines changed

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ FrameworkBundle
101101
* Remove option `--xliff-version` of the `translation:update` command, use e.g. `--output-format=xlf20` instead
102102
* Remove option `--output-format` of the `translation:update` command, use e.g. `--output-format=xlf20` instead
103103
* Remove the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
104+
* Remove `getDoctrine()` and `dispatchMessage()` in `AbstractController`, use method/constructor injection instead
104105

105106
HttpFoundation
106107
--------------

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Add autowiring alias for `HttpCache\StoreInterface`
88
* Deprecate the `AdapterInterface` autowiring alias, use `CacheItemPoolInterface` instead
99
* Deprecate the public `profiler` service to private
10+
* Deprecate `getDoctrine()` and `dispatchMessage()` in `AbstractController`, use method/constructor injection instead
1011

1112
5.3
1213
---

‎src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
use Twig\Environment;
5151

5252
/**
53-
* Provides common features needed in controllers.
53+
* Provides shortcuts for HTTP-related features in controllers.
5454
*
5555
* @author Fabien Potencier <fabien@symfony.com>
5656
*/
@@ -370,9 +370,13 @@ protected function createFormBuilder($data = null, array $options = []): FormBui
370370
* Shortcut to return the Doctrine Registry service.
371371
*
372372
* @throws \LogicException If DoctrineBundle is not available
373+
*
374+
* @deprecated since 5.4, inject an instance of ManagerRegistry in your controller instead
373375
*/
374376
protected function getDoctrine(): ManagerRegistry
375377
{
378+
trigger_deprecation('symfony/framework-bundle', '5.4', 'Method "%s()" is deprecated, inject an instance of ManagerRegistry in your controller instead.', __METHOD__);
379+
376380
if (!$this->container->has('doctrine')) {
377381
throw new \LogicException('The DoctrineBundle is not registered in your application. Try running "composer require symfony/orm-pack".');
378382
}
@@ -426,9 +430,13 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool
426430
* Dispatches a message to the bus.
427431
*
428432
* @param object|Envelope $message The message or the message pre-wrapped in an envelope
433+
*
434+
* @deprecated since 5.4, inject an instance of MessageBusInterface in your controller instead
429435
*/
430436
protected function dispatchMessage(object $message, array $stamps = []): Envelope
431437
{
438+
trigger_deprecation('symfony/framework-bundle', '5.4', 'Method "%s()" is deprecated, inject an instance of MessageBusInterface in your controller instead.', __METHOD__);
439+
432440
if (!$this->container->has('messenger.default_bus')) {
433441
$message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';
434442
throw new \LogicException('The message bus is not enabled in your application. '.$message);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.