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

findByPath() public method

Returns route-entity by route.
public findByPath ( string $path, string $locale ) : Sulu\Bundle\RouteBundle\Model\RouteInterface
$path string
$locale string
return Sulu\Bundle\RouteBundle\Model\RouteInterface
    public function findByPath($path, $locale);

Usage Example

 /**
  * {@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;
 }
All Usage Examples Of Sulu\Bundle\RouteBundle\Entity\RouteRepositoryInterface::findByPath
RouteRepositoryInterface