Ejemplo n.º 1
0
 public function updateRoute(Route $route)
 {
     if (!$route->getTypeId()) {
         $content = $route->getContent();
         $route->setTypeId($content->getId());
         $route->setType($this->resolver->getType($content));
         $route->setName(sprintf('dynamic_route_%s', $route->getId()));
         $this->entityManager->flush();
     }
 }
Ejemplo n.º 2
0
 public function postLoad(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     if ($entity instanceof Route) {
         $repository = $this->resolver->getRepository($entity->getType());
         if (!empty($repository)) {
             $content = $repository->find($entity->getTypeId());
             $entity->setContent($content);
         }
     }
 }
Ejemplo n.º 3
0
 public function getRoutes(Routeable $content)
 {
     $type = $this->routeContentResolver->getType($content);
     return $this->em->getRepository('EnhavoAppBundle:Route')->findBy(['type' => $type, 'typeId' => $content->getId()]);
 }