Пример #1
0
 /**
  * @param string $entityType
  * @param object $entity
  * @return \Magento\Catalog\Api\Data\ProductInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute($entityType, $entity)
 {
     /** @var \Magento\Catalog\Api\Data\ProductInterface $entity*/
     foreach ($this->productLinkRepository->getList($entity) as $link) {
         $this->productLinkRepository->delete($link);
     }
     foreach ($entity->getProductLinks() as $link) {
         $this->productLinkRepository->save($link);
     }
     return $entity;
 }