Example #1
0
 /**
  * @group Locale
  *
  * @return void
  */
 public function testDeleteLocaleDeletesSoftly()
 {
     $localeQuery = $this->localeQueryContainer->queryLocaleByName('ab_xy');
     $this->localeFacade->createLocale('ab_xy');
     $this->assertTrue($localeQuery->findOne()->getIsActive());
     $this->localeFacade->deleteLocale('ab_xy');
     $this->assertFalse($localeQuery->findOne()->getIsActive());
 }
Example #2
0
 /**
  * @return void
  */
 protected function installLocales()
 {
     $this->localeQueryContainer->getConnection()->beginTransaction();
     $localeFile = fopen($this->localeFile, 'r');
     while (!feof($localeFile)) {
         $locale = trim(fgets($localeFile));
         $query = $this->localeQueryContainer->queryLocaleByName($locale);
         if (!$query->count()) {
             $entity = new SpyLocale();
             $entity->setLocaleName($locale);
             $entity->setIsActive(1);
             $entity->save();
         }
     }
     $this->localeQueryContainer->getConnection()->commit();
 }
Example #3
0
 /**
  * @param string $localeName
  *
  * @return bool
  */
 public function deleteLocale($localeName)
 {
     if (!$this->hasLocale($localeName)) {
         return true;
     }
     $locale = $this->localeQueryContainer->queryLocaleByName($localeName)->findOne();
     $locale->setIsActive(false);
     $locale->save();
     return true;
 }