vendor/bluue/prestashop-connector-bundle/src/EventSubscriber/SalesBundle/OrderEditSubscriber.php line 44

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Léo BANNHOLTZER (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\PrestashopConnectorBundle\EventSubscriber\SalesBundle;
  9. use Bluue\SalesBundle\Event\OrderEditEvent;
  10. use Symfony\Component\Messenger\MessageBusInterface;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Bluue\PrestashopConnectorBundle\Message\EditDeliveryAddressOfOrderMessage;
  13. class OrderEditSubscriber implements EventSubscriberInterface
  14. {
  15.     /**
  16.      * @var MessageBusInterface $mappingmessageBusRepo
  17.      */
  18.     private MessageBusInterface $messageBus;
  19.     public function __construct(MessageBusInterface $messageBus)
  20.     {
  21.         $this->messageBus $messageBus;
  22.     }
  23.     /**
  24.      * @return array
  25.      */
  26.     public static function getSubscribedEvents(): array
  27.     {
  28.         return [
  29.             OrderEditEvent::POST_SUBMIT => 'postSubmit'
  30.         ];
  31.     }
  32.     /**
  33.      * @param OrderEditEvent $event
  34.      * @return void
  35.      */
  36.     public function postSubmit(OrderEditEvent $event): void
  37.     {
  38.         $this->messageBus->dispatch(
  39.             new EditDeliveryAddressOfOrderMessage($event->getOrder()->getId()->toRfc4122())
  40.         );
  41.     }
  42. }