Sulu\Bundle\RouteBundle\Entity\RouteRepositoryInterface::find PHP Method

find() public method

Returns route-entity by id.
public find ( integer $id ) : Sulu\Bundle\RouteBundle\Model\RouteInterface
$id integer
return Sulu\Bundle\RouteBundle\Model\RouteInterface
    public function find($id);

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getRouteByName($name)
 {
     if (strpos($name, self::ROUTE_PREFIX) !== 0) {
         throw new RouteNotFoundException();
     }
     $routeId = substr($name, strlen(self::ROUTE_PREFIX));
     if (array_key_exists($routeId, $this->symfonyRouteCache)) {
         return $this->symfonyRouteCache[$routeId];
     }
     /** @var RouteInterface $route */
     $route = $this->routeRepository->find($routeId);
     if (!$route || !$this->routeDefaultsProvider->supports($route->getEntityClass()) || !$this->routeDefaultsProvider->isPublished($route->getEntityClass(), $route->getEntityId(), $route->getLocale())) {
         throw new RouteNotFoundException();
     }
     return $this->createRoute($route, $this->requestStack->getCurrentRequest());
 }
RouteRepositoryInterface