public function updateRoute(Route $route)
 {
     if (!$route->getTypeId()) {
         $this->routeManager->update($route);
         $this->entityManager->flush();
     }
 }
 public function updateTranslationRoute(Routeable $routeable, $locale, $staticPrefix)
 {
     $route = $routeable->getRoute();
     $return = null;
     if (!$route instanceof Route) {
         return null;
     }
     $translationRoute = $this->em->getRepository('EnhavoTranslationBundle:TranslationRoute')->findOneBy(['type' => $route->getType(), 'typeId' => $route->getTypeId(), 'locale' => $locale]);
     if ($translationRoute === null) {
         $route = new Route();
         $route->setContent($routeable);
         $translationRoute = new TranslationRoute();
         $translationRoute->setLocale($locale);
         $translationRoute->setRoute($route);
         $this->em->persist($translationRoute);
     }
     /** @var Route $route */
     $route = $translationRoute->getRoute();
     $route->setStaticPrefix($staticPrefix);
     $translationRoute->setPath($staticPrefix);
     $this->em->flush();
     $this->routeManager->update($route);
     $translationRoute->setType($route->getType());
     $translationRoute->setTypeId($route->getTypeId());
     $this->em->flush();
     return $translationRoute;
 }
Example #3
0
 protected function updateRoute(GeneratorInterface $generator, Routeable $routeable)
 {
     $staticPrefix = $generator->generate($routeable);
     $route = $routeable->getRoute();
     if ($route instanceof Route) {
         $route->setStaticPrefix($staticPrefix);
     } else {
         $this->routeManager->createRoute($routeable, $staticPrefix);
     }
     $this->em->flush();
     $this->routeManager->update($route);
     $this->em->flush();
 }