public function load(ObjectManager $manager) { $locales = $this->container->get('locales'); $category = new Category($locales->getLocaleActive()); $category->setName('Light side of the Force'); $category->setDescription('The Light Side of the Force was aligned with calmness and was used for knowledge and defense'); $manager->persist($category); $this->addReference('category', $category); foreach ($locales->getLocales() as $locale) { if (!$locale['active']) { $translationCategory = new Category($locale['code']); $translationCategory->setName($locale['code'] . ' Light side of the Force'); $translationCategory->setDescription($locale['code'] . ' The Light Side of the Force was aligned with calmness and was used for knowledge and defense'); $translationCategory->setParentMultilangue($category); $manager->persist($translationCategory); $reference = 'translationcategory-' . $locale['code']; $this->addReference($reference, $translationCategory); } } $manager->flush(); }