|
50 | 50 | use Twig\Environment;
|
51 | 51 |
|
52 | 52 | /**
|
53 |
| - * Provides common features needed in controllers. |
| 53 | + * Provides shortcuts for HTTP-related features in controllers. |
54 | 54 | *
|
55 | 55 | * @author Fabien Potencier <[email protected]>
|
56 | 56 | */
|
@@ -370,9 +370,13 @@ protected function createFormBuilder($data = null, array $options = []): FormBui
|
370 | 370 | * Shortcut to return the Doctrine Registry service.
|
371 | 371 | *
|
372 | 372 | * @throws \LogicException If DoctrineBundle is not available
|
| 373 | + * |
| 374 | + * @deprecated since 5.4, inject an instance of ManagerRegistry in your controller instead |
373 | 375 | */
|
374 | 376 | protected function getDoctrine(): ManagerRegistry
|
375 | 377 | {
|
| 378 | + trigger_deprecation('symfony/framework-bundle', '5.4', 'Method "%s()" is deprecated, inject an instance of ManagerRegistry in your controller instead.', __METHOD__); |
| 379 | + |
376 | 380 | if (!$this->container->has('doctrine')) {
|
377 | 381 | throw new \LogicException('The DoctrineBundle is not registered in your application. Try running "composer require symfony/orm-pack".');
|
378 | 382 | }
|
@@ -426,9 +430,13 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool
|
426 | 430 | * Dispatches a message to the bus.
|
427 | 431 | *
|
428 | 432 | * @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 |
429 | 435 | */
|
430 | 436 | protected function dispatchMessage(object $message, array $stamps = []): Envelope
|
431 | 437 | {
|
| 438 | + trigger_deprecation('symfony/framework-bundle', '5.4', 'Method "%s()" is deprecated, inject an instance of MessageBusInterface in your controller instead.', __METHOD__); |
| 439 | + |
432 | 440 | if (!$this->container->has('messenger.default_bus')) {
|
433 | 441 | $message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';
|
434 | 442 | throw new \LogicException('The message bus is not enabled in your application. '.$message);
|
|
0 commit comments