vendor/thelia/core/lib/Thelia/Action/Export.php line 71

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Thelia package.
  4.  * http://www.thelia.net
  5.  *
  6.  * (c) OpenStudio <info@thelia.net>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Thelia\Action;
  12. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  13. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  14. use Thelia\Core\Event\TheliaEvents;
  15. use Thelia\Core\Event\UpdatePositionEvent;
  16. use Thelia\Handler\ExportHandler;
  17. use Thelia\Model\ExportCategoryQuery;
  18. use Thelia\Model\ExportQuery;
  19. /**
  20.  * Class Export.
  21.  *
  22.  * @author Jérôme Billiras <jbilliras@openstudio.fr>
  23.  */
  24. class Export extends BaseAction implements EventSubscriberInterface
  25. {
  26.     /**
  27.      * @var \Thelia\Handler\ExportHandler The export handler
  28.      */
  29.     protected $handler;
  30.     /**
  31.      * @param \Thelia\Handler\ExportHandler $exportHandler The export handler
  32.      */
  33.     public function __construct(ExportHandler $exportHandler)
  34.     {
  35.         $this->handler $exportHandler;
  36.     }
  37.     public static function getSubscribedEvents()
  38.     {
  39.         return [
  40.             TheliaEvents::EXPORT_CHANGE_POSITION => [
  41.                 ['exportChangePosition'128],
  42.             ],
  43.             TheliaEvents::EXPORT_CATEGORY_CHANGE_POSITION => [
  44.                 ['exportCategoryChangePosition'128],
  45.             ],
  46.         ];
  47.     }
  48.     /**
  49.      * Handle export change position event.
  50.      *
  51.      * @param $eventName
  52.      */
  53.     public function exportChangePosition(UpdatePositionEvent $updatePositionEvent$eventNameEventDispatcherInterface $dispatcher): void
  54.     {
  55.         $this->handler->getExport($updatePositionEvent->getObjectId(), true);
  56.         $this->genericUpdatePosition(new ExportQuery(), $updatePositionEvent$dispatcher);
  57.     }
  58.     /**
  59.      * Handle export category change position event.
  60.      *
  61.      * @param $eventName
  62.      */
  63.     public function exportCategoryChangePosition(UpdatePositionEvent $updatePositionEvent$eventNameEventDispatcherInterface $dispatcher): void
  64.     {
  65.         $this->handler->getCategory($updatePositionEvent->getObjectId(), true);
  66.         $this->genericUpdatePosition(new ExportCategoryQuery(), $updatePositionEvent$dispatcher);
  67.     }
  68. }