示例#1
0
 /**
  * @param ImportProduct $import
  * @param bool $result
  * @return bool
  */
 public function afterImportData(ImportProduct $import, $result)
 {
     if ($import->getAffectedEntityIds()) {
         foreach ($import->getAffectedEntityIds() as $productId) {
             $product = $this->productRepository->getById($productId);
             $productUrls = $this->productUrlRewriteGenerator->generate($product);
             if ($productUrls) {
                 $this->urlPersist->replace($productUrls);
             }
         }
     } elseif (ImportExport::BEHAVIOR_DELETE == $import->getBehavior()) {
         $this->clearProductUrls($import);
     }
     return $result;
 }