public function testLocale() { $this->assertNull($this->caseSource->getLocale()); $locale = 'en'; $this->assertEquals($this->caseSource, $this->caseSource->setLocale($locale)); $this->assertEquals($locale, $this->caseSource->getLocale()); }
/** * Load entities to DB * * @param ObjectManager $manager */ protected function loadEntities(ObjectManager $manager) { $sourceRepository = $manager->getRepository('OroCRMCaseBundle:CaseSource'); $translationLocales = $this->getTranslationLocales(); foreach ($translationLocales as $locale) { foreach ($this->sourceNames as $sourceName) { // get case source entity /** @var CaseSource $caseSource */ $caseSource = $sourceRepository->findOneBy(array('name' => $sourceName)); if (!$caseSource) { $caseSource = new CaseSource($sourceName); } // set locale and label $sourceLabel = $this->translate($sourceName, static::CASE_SOURCE_PREFIX, $locale); $caseSource->setLocale($locale)->setLabel($sourceLabel); // save $manager->persist($caseSource); } $manager->flush(); } }