/**
* {@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;
}