/**
  * Gets the 'stof_doctrine_extensions.listener.translatable' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * This service is private.
  * If you want to be able to request this service from the container directly,
  * make it public, otherwise you might end up with broken code.
  *
  * @return \Gedmo\Translatable\TranslatableListener A Gedmo\Translatable\TranslatableListener instance
  */
 protected function getStofDoctrineExtensions_Listener_TranslatableService()
 {
     $this->services['stof_doctrine_extensions.listener.translatable'] = $instance = new \Gedmo\Translatable\TranslatableListener();
     $instance->setAnnotationReader($this->get('annotation_reader'));
     $instance->setDefaultLocale('en');
     $instance->setTranslatableLocale('en');
     $instance->setTranslationFallback(false);
     $instance->setPersistDefaultLocaleTranslation(false);
     $instance->setSkipOnLoad(false);
     return $instance;
 }
Beispiel #2
0
 /**
  * @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.');
     }
     $translatableListener = new \Gedmo\Translatable\TranslatableListener();
     $translatableListener->setDefaultLocale($defaultLocale->locale);
     $translatableListener->setAnnotationReader($this->cachedAnnotationReader);
     $translatableListener->setTranslationFallback(true);
     $translatableListener->setPersistDefaultLocaleTranslation(true);
     $this->eventManager->addEventSubscriber($translatableListener);
     return $this;
 }