public function postPersist(LifecycleEventArgs $args)
 {
     $doc = $args->getDocument();
     if (!$doc instanceof Route) {
         return;
     }
     $this->updateLocale($doc, $doc->getId());
 }
Ejemplo n.º 2
0
 protected function updateId(LifecycleEventArgs $args)
 {
     $doc = $args->getDocument();
     // only update route objects and only if the prefix can match, to allow
     // for more than one listener and more than one route root
     if ($doc instanceof Route && !strncmp($this->idPrefix, $doc->getId(), strlen($this->idPrefix))) {
         $doc->setPrefix($this->idPrefix);
     }
 }
Ejemplo n.º 3
0
 /**
  * Load the translatable properties from a subnode into the Node being read.
  */
 public function postLoad(LifecycleEventArgs $eventArgs)
 {
     $document = $eventArgs->getDocument();
     $translationInfo = $this->reader->translationInformation(get_class($document));
     if (!$translationInfo->isTranslatable()) {
         return;
     }
     switch ($translationInfo->getTranslationStrategy()) {
         case Information::STRATEGY_CHILD:
             $this->loadTranslationFromNode($document, $translationInfo);
             break;
         case Information::STRATEGY_ATTRIBUTE:
             $this->loadTranslationFromAttribute($document, $translationInfo);
             break;
         default:
             throw new \Exception('Unknown translation strategy constant ' . $translationInfo->getTranslationStrategy());
     }
 }