/** * @param ProductInterface $product * @param array $options */ private function createTranslations(ProductInterface $product, array $options) { foreach ($this->getLocales() as $localeCode) { $product->setCurrentLocale($localeCode); $product->setFallbackLocale($localeCode); $product->setName($options['name']); $product->setSlug($this->slugGenerator->generate($options['name'])); $product->setShortDescription($options['short_description']); $product->setDescription($options['description']); } }
protected function addTranslatedFields(ProductInterface $product, $translatedNames) { foreach ($translatedNames as $locale => $name) { $product->setCurrentLocale($locale); $product->setFallbackLocale($locale); $product->setName($name); $product->setDescription($this->fakers[$locale]->paragraph); $product->setShortDescription($this->fakers[$locale]->sentence); $product->setMetaKeywords(str_replace(' ', ', ', $this->fakers[$locale]->sentence)); $product->setMetaDescription($this->fakers[$locale]->sentence); } $product->setCurrentLocale($this->defaultLocale); }