<?php
namespace App\EventListener\Importer\Ecomerce;
use Pimcore\Bundle\DataImporterBundle\Event\DataObject\PreSaveEvent;
class EcomCatSecClearListener
{
public function onPreSave(PreSaveEvent $event)
{
if ($event->getConfigName() !== 'ecomCatSecundariasClear') {
return;
}
$data = $event->getRawData();
$product = $event->getDataObject();
$productKey = $data[0];
if (empty($productKey)) {
return;
}
$product->setCategoriasSecundarias([]);
}
}