From a7a8913addc3c8442f9d2c8bbc4679ba7ce9a0e8 Mon Sep 17 00:00:00 2001 From: Steven Renaux <59167761+StevenRenaux@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:20:58 +0200 Subject: [PATCH 1/2] Update event_dispatcher.rst --- components/event_dispatcher.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index 68d7a5f39e6..ae566e51370 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -316,7 +316,9 @@ of the event to dispatch:: // creates the OrderPlacedEvent and dispatches it $event = new OrderPlacedEvent($order); - $dispatcher->dispatch($event, OrderPlacedEvent::NAME); + + //The event name is now optional in the dispatch() method, so you can pass just the event object + $dispatcher->dispatch($event); Notice that the special ``OrderPlacedEvent`` object is created and passed to the ``dispatch()`` method. Now, any listener to the ``order.placed`` From 30522c54e9040a8ff8b75ebf0dba93e43024c375 Mon Sep 17 00:00:00 2001 From: Steven Renaux <59167761+StevenRenaux@users.noreply.github.com> Date: Wed, 5 Jul 2023 14:22:30 +0200 Subject: [PATCH 2/2] Update components/event_dispatcher.rst Co-authored-by: Oskar Stark --- components/event_dispatcher.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index ae566e51370..2666dd26df5 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -317,7 +317,7 @@ of the event to dispatch:: // creates the OrderPlacedEvent and dispatches it $event = new OrderPlacedEvent($order); - //The event name is now optional in the dispatch() method, so you can pass just the event object + // The event name is now optional in the dispatch() method, so you can pass just the event object $dispatcher->dispatch($event); Notice that the special ``OrderPlacedEvent`` object is created and passed to