Пример #1
0
 /**
  * @param ProductInterface $product
  * @param string $name
  * @param string $locale
  */
 private function addProductTranslation(ProductInterface $product, $name, $locale)
 {
     /** @var ProductTranslationInterface|TranslationInterface $translation */
     $translation = $this->productTranslationFactory->createNew();
     $translation->setLocale($locale);
     $translation->setName($name);
     $translation->setSlug($this->slugGenerator->generate($name));
     $product->addTranslation($translation);
 }
Пример #2
0
 /**
  * @Given /^(this product) is named "([^"]+)" (in the "([^"]+)" locale)$/
  */
 public function thisProductIsNamedIn(ProductInterface $product, $name, $locale)
 {
     /** @var ProductTranslationInterface $translation */
     $translation = $this->productTranslationFactory->createNew();
     $translation->setLocale($locale);
     $translation->setName($name);
     $product->addTranslation($translation);
     $this->objectManager->flush();
 }