platform/src/Core/Framework/MessageQueue/Subscriber/DeadMessageLoadedSubscriber.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\MessageQueue\Subscriber;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  4. use Shopware\Core\Framework\MessageQueue\DeadMessage\DeadMessageEntity;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class DeadMessageLoadedSubscriber implements EventSubscriberInterface
  7. {
  8.     public static function getSubscribedEvents(): array
  9.     {
  10.         return ['dead_message.loaded' => ['unserialize']];
  11.     }
  12.     public function unserialize(EntityLoadedEvent $event): void
  13.     {
  14.         /** @var DeadMessageEntity $deadMessage */
  15.         foreach ($event->getEntities() as $deadMessage) {
  16.             if ($deadMessage->getSerializedOriginalMessage()) {
  17.                 $deadMessage->setOriginalMessage(unserialize($deadMessage->getSerializedOriginalMessage()));
  18.             }
  19.         }
  20.     }
  21. }