src/EventListener/Importer/Ecomerce/EcomCatSecClearListener.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\EventListener\Importer\Ecomerce;
  3. use Pimcore\Bundle\DataImporterBundle\Event\DataObject\PreSaveEvent;
  4. class EcomCatSecClearListener
  5. {
  6.     public function onPreSave(PreSaveEvent $event)
  7.     {
  8.         if ($event->getConfigName() !== 'ecomCatSecundariasClear') {
  9.             return;
  10.         }
  11.         $data $event->getRawData();
  12.         $product $event->getDataObject();
  13.         $productKey $data[0];
  14.         if (empty($productKey)) {
  15.             return;
  16.         }
  17.         $product->setCategoriasSecundarias([]);
  18.     }
  19. }