Пример #1
0
 /**
  * @param object $entity
  * @param array $arguments
  * @return \Magento\Catalog\Api\Data\ProductInterface|object
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute($entity, $arguments = [])
 {
     /** @var \Magento\Catalog\Api\Data\ProductInterface $entity */
     foreach ($this->optionRepository->getProductOptions($entity) as $option) {
         $this->optionRepository->delete($option);
     }
     if ($entity->getOptions()) {
         foreach ($entity->getOptions() as $option) {
             $this->optionRepository->save($option);
         }
     }
     return $entity;
 }