public function create(RoutableInterface $entity, $path = null)
{
if (null !== $entity->getRoute()) {
throw new RouteAlreadyCreatedException($entity);
}
$config = $this->getClassMappingConfiguration(get_class($entity));
if (null === $path) {
$path = $this->routeGenerators[$config['generator']]->generate($entity, $config['options']);
}
$route = $this->routeRepository->createNew()->setPath($path)->setEntityClass(get_class($entity))->setEntityId($entity->getId())->setLocale($entity->getLocale());
$route = $this->conflictResolver->resolve($route);
$entity->setRoute($route);
return $route;
}