/** * {@inheritdoc} */ public function apply(ProductTemplateInterface $template, array $products) { $this->templateUpdater->update($template, $products); $results = $this->validateProducts($products); $validProducts = $results['products']; $violations = $results['violations']; $this->productSaver->saveAll($validProducts); return $violations; }
/** * {@inheritdoc} */ public function perform() { parent::perform(); if (null !== $this->group->getProductTemplate()) { $this->templateUpdater->update($this->group->getProductTemplate(), $this->objects); } }
/** * @param ProductInterface $product */ protected function setProductValuesFromVariantGroup(ProductInterface $product) { $variantGroup = $product->getVariantGroup(); if ($variantGroup !== null && $variantGroup->getProductTemplate() !== null) { $template = $variantGroup->getProductTemplate(); $this->templateUpdater->update($template, [$product]); } }
/** * {@inheritdoc} */ public function process($product) { $configuration = $this->getJobConfiguration(); if (!array_key_exists('actions', $configuration)) { throw new InvalidArgumentException('Missing configuration for \'actions\'.'); } $actions = $configuration['actions']; $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; } $this->stepExecution->incrementSummaryInfo('mass_edited'); return $product; }