diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php index 2f20678e31..9cb7a58f6e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php @@ -28,6 +28,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Messenger\Envelope; +use Symfony\Component\Messenger\Stamp\StampInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Csrf\CsrfToken; @@ -397,18 +398,19 @@ trait ControllerTrait /** * Dispatches a message to the bus. * - * @param object|Envelope $message The message or the message pre-wrapped in an envelope + * @param object|Envelope $message The message or the message pre-wrapped in an envelope + * @param StampInterface[] $stamps * * @final */ - protected function dispatchMessage($message): Envelope + protected function dispatchMessage($message, array $stamps = []): Envelope { if (!$this->container->has('messenger.default_bus')) { $message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".'; throw new \LogicException('The message bus is not enabled in your application. '.$message); } - return $this->container->get('messenger.default_bus')->dispatch($message); + return $this->container->get('messenger.default_bus')->dispatch($message, $stamps); } /**