vendor/pimcore/data-importer/src/EventListener/DataImporterListener.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Bundle\DataImporterBundle\EventListener;
  15. use Pimcore\Bundle\DataImporterBundle\Event\PostPreparationEvent;
  16. use Pimcore\Bundle\DataImporterBundle\Messenger\DataImporterHandler;
  17. class DataImporterListener
  18. {
  19.     public function __construct(
  20.         protected DataImporterHandler $dataImporterHandler,
  21.         protected bool $messengerQueueActivated
  22.     ) {
  23.     }
  24.     public function importPrepared(PostPreparationEvent $event)
  25.     {
  26.         if ($this->messengerQueueActivated === true) {
  27.             $this->dataImporterHandler->dispatchMessages($event->getExecutionType());
  28.         }
  29.     }
  30. }