コード例 #1
0
ファイル: Database.php プロジェクト: fraym/core
 /**
  * @return $this
  * @throws \Exception
  */
 public function setUpTranslateable()
 {
     $defaultLocale = $this->locale->getDefaultLocale();
     if ($defaultLocale === null) {
         throw new \Exception('Default locale not found! Fraym is not correctly installed, please reinstall Fraym.');
     }
     $this->translatableListener = new \Gedmo\Translatable\TranslatableListener();
     $this->translatableListener->setDefaultLocale($defaultLocale->locale);
     $this->translatableListener->setAnnotationReader($this->cachedAnnotationReader);
     $this->translatableListener->setTranslationFallback(true);
     $this->translatableListener->setPersistDefaultLocaleTranslation(true);
     $this->eventManager->addEventSubscriber($this->translatableListener);
     return $this;
 }