File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ of the event to dispatch::
348
348
// creates the OrderPlacedEvent and dispatches it
349
349
$event = new OrderPlacedEvent($order);
350
350
$dispatcher->dispatch($event, OrderPlacedEvent::NAME);
351
+ // note that ``OrderPlacedEvent::NAME`` is optional, read below
351
352
352
353
Notice that the special ``OrderPlacedEvent `` object is created and passed to
353
354
the ``dispatch() `` method. Now, any listener to the ``order.placed ``
@@ -391,6 +392,9 @@ Take the following example of a subscriber that subscribes to the
391
392
['onKernelResponsePost', -10],
392
393
],
393
394
OrderPlacedEvent::NAME => 'onStoreOrder',
395
+ // note that you can also subscribe like this
396
+ // when passing only the event
397
+ OrderPlacedEvent::class => 'onStoreOrder',
394
398
];
395
399
}
396
400
You can’t perform that action at this time.
0 commit comments