findByPath() 공개 메소드

Returns route-entity by route.
public findByPath ( string $path, string $locale ) : Sulu\Bundle\RouteBundle\Model\RouteInterface
$path string
$locale string
리턴 Sulu\Bundle\RouteBundle\Model\RouteInterface
예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function resolve(RouteInterface $route)
 {
     $i = 1;
     $path = $route->getPath();
     $conflict = $this->routeRepository->findByPath($route->getPath(), $route->getLocale());
     while ($conflict) {
         if ($conflict && $conflict->getEntityClass() === $route->getEntityClass() && $conflict->getEntityId() == $route->getEntityId()) {
             // if conflict is found but has the same entity relation return this instead of the newly created route.
             return $conflict;
         }
         $route->setPath($path . '-' . $i++);
         $conflict = $this->routeRepository->findByPath($route->getPath(), $route->getLocale());
     }
     return $route;
 }
예제 #2
0
파일: RouteProvider.php 프로젝트: sulu/sulu
 /**
  * Find route and cache it.
  *
  * @param string $path
  * @param string $locale
  *
  * @return SuluRoute
  */
 private function findRouteByPath($path, $locale)
 {
     $path = '/' . ltrim($path, '/');
     if (!array_key_exists($path, $this->routeCache)) {
         $this->routeCache[$path] = $this->routeRepository->findByPath($path, $locale);
     }
     return $this->routeCache[$path];
 }