We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27057aa commit 2581f0dCopy full SHA for 2581f0d
1 file changed
src/Dispatcher/OrderMessageDispatcher.php
@@ -12,18 +12,26 @@
12
namespace BitBag\SyliusUserComPlugin\Dispatcher;
13
14
use BitBag\SyliusUserComPlugin\Message\OrderSynchronization;
15
+use Psr\Log\LoggerInterface;
16
use Sylius\Component\Core\Model\OrderInterface;
17
use Symfony\Component\Messenger\MessageBusInterface;
18
19
final class OrderMessageDispatcher implements OrderMessageDispatcherInterface
20
{
21
public function __construct(
22
private readonly MessageBusInterface $messageBus,
23
+ private readonly LoggerInterface $logger
24
) {
25
}
26
27
public function dispatch(OrderInterface $order): void
28
29
+ if (null === $order->getId()) {
30
+ $this->logger->error('Order ID cannot be null');
31
+
32
+ return;
33
+ }
34
35
$this->messageBus->dispatch(new OrderSynchronization($order->getId()));
36
37
0 commit comments