From 4d7398fdc7490b785e24ba4c8700d34c75498da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20REYNAUD?= Date: Fri, 21 Oct 2022 09:19:16 +0200 Subject: [PATCH] #17378: Add documentation for allow_no_senders --- messenger/multiple_buses.rst | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst index 724c58d5e3f..3bab5a69221 100644 --- a/messenger/multiple_buses.rst +++ b/messenger/multiple_buses.rst @@ -36,7 +36,12 @@ an **event bus**. The event bus could have zero or more subscribers. event.bus: # the 'allow_no_handlers' middleware allows to have no handler # configured for this bus without throwing an exception - default_middleware: allow_no_handlers + # the 'allow_no_senders' middleware allows to have no sender + # configured for this bus without throwing an exception + default_middleware: + enabled: true + allow_no_handlers: false + allow_no_senders: true middleware: - validation @@ -64,7 +69,10 @@ an **event bus**. The event bus could have zero or more subscribers. - + + + @@ -88,9 +96,15 @@ an **event bus**. The event bus could have zero or more subscribers. $queryBus->middleware()->id('validation'); $eventBus = $framework->messenger()->bus('event.bus'); - // the 'allow_no_handlers' middleware allows to have no handler + // the 'allowNoHandlers' middleware allows to have no handler + // configured for this bus without throwing an exception + // the 'allowNoSenders' middleware allows to have no sender // configured for this bus without throwing an exception - $eventBus->defaultMiddleware('allow_no_handlers'); + $eventBus->defaultMiddleware() + ->enabled(true) + ->allowNoHandlers(false) + ->allowNoSenders(true) + ; $eventBus->middleware()->id('validation'); };