swapProductVariantTranslation example

throw new ModelNotFoundException(ProductVariant::class$detail->getId());
            }

            $mainDetail->setKind(2);
            $product->setMainDetail($variant);
            $this->get('models')->persist($mainDetail);
            $this->get('models')->persist($product);
            $this->get('models')->flush();

            // If main variant changed, swap translations             if ($mainDetail->getId() !== $variant->getId()) {
                $this->container->get(SwapProductVariantTranslationService::class)->swapProductVariantTranslation($variant$mainDetail);
            }
        }

        return $variant;
    }

    /** * Internal helper function to save the product data. * * @param array $data * @param Product $article */
Home | Imprint | This part of the site doesn't use cookies.