public function testLocale() { $this->assertNull($this->casePriority->getLocale()); $locale = 'en'; $this->assertEquals($this->casePriority, $this->casePriority->setLocale($locale)); $this->assertEquals($locale, $this->casePriority->getLocale()); }
/** * Load entities to DB * * @param ObjectManager $manager */ protected function loadEntities(ObjectManager $manager) { $priorityRepository = $manager->getRepository('OroCRMCaseBundle:CasePriority'); $translationLocales = $this->getTranslationLocales(); foreach ($translationLocales as $locale) { foreach ($this->priorityNames as $order => $priorityName) { /** @var CasePriority $casePriority */ $casePriority = $priorityRepository->findOneBy(array('name' => $priorityName)); if (!$casePriority) { $casePriority = new CasePriority($priorityName); $casePriority->setOrder($order); } // set locale and label $priorityLabel = $this->translate($priorityName, static::CASE_PRIORITY_PREFIX, $locale); $casePriority->setLocale($locale)->setLabel($priorityLabel); // save $manager->persist($casePriority); } $manager->flush(); } }