src/Sulu/Component/CustomUrl/Document/Subscriber/CustomUrlSubscriber.php
protected function findOrCreateRoute($path, $locale, CustomUrlBehavior $document, $route)
    {
        try {
            /** @var RouteDocument $routeDocument */
            $routeDocument = $this->documentManager->find($path, $locale);
        } catch (DocumentNotFoundException $ex) {
            return $this->documentManager->create('custom_url_route');
        }

        if (!$routeDocument instanceof RouteDocument
            || $routeDocument->getTargetDocument()->getUuid() !== $document->getUuid()
        ) {
            throw new ResourceLocatorAlreadyExistsException($route, $document->getTitle());
        }

        return $routeDocument;
    }
protected function findOrCreateRoute($path, $locale, CustomUrlBehavior $document, $route)
    {
        try {
            /** @var RouteDocument $routeDocument */
            $routeDocument = $this->documentManager->find($path, $locale);
        } catch (DocumentNotFoundException $ex) {
            return $this->documentManager->create('custom_url_route');
        }

        if (!$routeDocument instanceof RouteDocument
            || $routeDocument->getTargetDocument()->getUuid() !== $document->getUuid()
        ) {
            throw new ResourceLocatorAlreadyExistsException($route, $document->getTitle());
        }

        return $routeDocument;
    }
protected function findOrCreateRoute ( $ path , $ locale , CustomUrlBehavior $ document , $ route ) { try { /** @var RouteDocument $routeDocument */ $ routeDocument = $ this -> documentManager -> find ( $ path , $ locale ) ; } catch ( DocumentNotFoundException $ ex ) { return $ this -> documentManager -> create ( 'custom_url_route' ) ; } if ( ! $ routeDocument instanceof RouteDocument || $ routeDocument -> getTargetDocument ( ) -> getUuid ( ) !== $ document -> getUuid ( ) ) { throw new ResourceLocatorAlreadyExistsException ( $ route , $ document -> getTitle ( ) ) ; } return $ routeDocument ; }
Find or create route-document for given path.

@param string $path
@param string $locale
@param CustomUrlBehavior $document
@param string $route

@return RouteDocument

@throws ResourceLocatorAlreadyExistsException
Find or create route - document for given path .