Sulu\Bundle\RouteBundle\Manager\RouteManager::create PHP Method

create() public method

public create ( Sulu\Bundle\RouteBundle\Model\RoutableInterface $entity, $path = null )
$entity Sulu\Bundle\RouteBundle\Model\RoutableInterface
    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;
    }