custom/plugins/MolliePayments/src/Subscriber/OrderEditSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Kiener\MolliePayments\Subscriber;
  4. use Kiener\MolliePayments\Service\Order\OrderExpireService;
  5. use Shopware\Core\Checkout\Order\OrderCollection;
  6. use Shopware\Storefront\Page\Account\Order\AccountOrderPageLoadedEvent;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. class OrderEditSubscriber implements EventSubscriberInterface
  9. {
  10.     /**
  11.      * @var OrderExpireService
  12.      */
  13.     private $orderExpireService;
  14.     public function __construct(
  15.         OrderExpireService $orderExpireService
  16.     ) {
  17.         $this->orderExpireService $orderExpireService;
  18.     }
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             AccountOrderPageLoadedEvent::class => 'accountOrderDetailPageLoaded'
  23.         ];
  24.     }
  25.     public function accountOrderDetailPageLoaded(AccountOrderPageLoadedEvent $event): void
  26.     {
  27.         /** @var OrderCollection $orders */
  28.         $orders $event->getPage()->getOrders()->getEntities();
  29.         $context $event->getContext();
  30.         $rested $this->orderExpireService->cancelExpiredOrders($orders$context);
  31.     }
  32. }