/**
  * {@inheritdoc}
  */
 public function process($product)
 {
     $actions = $this->getConfiguredActions();
     $variantGroup = $actions['value'];
     $variantGroup = $this->groupRepository->findOneByIdentifier($variantGroup);
     $variantGroup->addProduct($product);
     if (null !== $variantGroup->getProductTemplate()) {
         $this->templateUpdater->update($variantGroup->getProductTemplate(), [$product]);
     }
     if (null === $product || null !== $product && !$this->isProductValid($product)) {
         $this->stepExecution->incrementSummaryInfo('skipped_products');
         return null;
     }
     return $product;
 }
Пример #2
0
 /**
  * Remove a variant group
  *
  * @param string $code
  *
  * @AclAncestor("pim_enrich_group_remove")
  *
  * @return JsonResponse
  */
 public function removeAction($code)
 {
     $group = $this->groupRepository->findOneByIdentifier($code);
     if (null === $group) {
         throw new NotFoundHttpException(sprintf('Group with code "%s" not found', $code));
     }
     $this->remover->remove($group);
     return new JsonResponse();
 }