예제 #1
0
 public function testLocale()
 {
     $this->assertNull($this->caseStatus->getLocale());
     $locale = 'en';
     $this->assertEquals($this->caseStatus, $this->caseStatus->setLocale($locale));
     $this->assertEquals($locale, $this->caseStatus->getLocale());
 }
예제 #2
0
 /**
  * Load entities to DB
  *
  * @param ObjectManager $manager
  */
 protected function loadEntities(ObjectManager $manager)
 {
     $statusRepository = $manager->getRepository('OroCRMCaseBundle:CaseStatus');
     $translationLocales = $this->getTranslationLocales();
     foreach ($translationLocales as $locale) {
         foreach ($this->statusNames as $order => $statusName) {
             // get case status entity
             /** @var CaseStatus $caseStatus */
             $caseStatus = $statusRepository->findOneBy(array('name' => $statusName));
             if (!$caseStatus) {
                 $caseStatus = new CaseStatus($statusName);
                 $caseStatus->setOrder($order);
             }
             // set locale and label
             $statusLabel = $this->translate($statusName, static::CASE_STATUS_PREFIX, $locale);
             $caseStatus->setLocale($locale)->setLabel($statusLabel);
             // save
             $manager->persist($caseStatus);
         }
         $manager->flush();
     }
 }