Skip to content

Commit c9494ec

Browse files
committed
minor #1446 Add notice to messenger for async code (94noni)
This PR was merged into the main branch. Discussion ---------- Add notice to messenger for async code While reading this, I found that pointing messenger here can be valuable (logic of decoupling) Also, reading the code itself of the dispatch, I remind my old PR symfony/symfony-docs#17035 there is no doc referencing the new `->dispatch(new ClassName())` as far as I see in https://symfony.com/doc/current/components/event_dispatcher.html#dispatch-the-event Commits ------- 3b7a46d Add notice to messenger for async code
2 parents 1f5547f + 3b7a46d commit c9494ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Controller/BlogController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public function commentNew(
123123
// passed in the event and they can even modify the execution flow, so
124124
// there's no guarantee that the rest of this controller will be executed.
125125
// See https://symfony.com/doc/current/components/event_dispatcher.html
126+
// You can also leverage the Symfony Messenger component if you need
127+
// some asynchronous operations.
128+
// See https://symfony.com/doc/current/messenger.html
126129
$eventDispatcher->dispatch(new CommentCreatedEvent($comment));
127130

128131
return $this->redirectToRoute('blog_post', ['slug' => $post->getSlug()]);

0 commit comments

Comments
 (0)