src/Sulu/Component/CustomUrl/Document/Subscriber/CustomUrlSubscriber.php
protected function createRoute(
        $domain,
        CustomUrlBehavior $document,
        Localization $locale,
        $persistedLocale,
        $routesPath
    ) {
        $path = sprintf('%s/%s', $routesPath, $domain);
        $routeDocument = $this->findOrCreateRoute($path, $persistedLocale, $document, $domain);
        $routeDocument->setTargetDocument($document);
        $routeDocument->setLocale($locale->getLocale());
        $routeDocument->setHistory(false);

        $this->documentManager->persist(
            $routeDocument,
            $persistedLocale,
            [
                'path' => $path,
                'auto_create' => true,
            ]
        );
        $this->documentManager->publish($routeDocument, $persistedLocale);

        return $routeDocument;
    }
protected function createRoute(
        $domain,
        CustomUrlBehavior $document,
        Localization $locale,
        $persistedLocale,
        $routesPath
    ) {
        $path = sprintf('%s/%s', $routesPath, $domain);
        $routeDocument = $this->findOrCreateRoute($path, $persistedLocale, $document, $domain);
        $routeDocument->setTargetDocument($document);
        $routeDocument->setLocale($locale->getLocale());
        $routeDocument->setHistory(false);

        $this->documentManager->persist(
            $routeDocument,
            $persistedLocale,
            [
                'path' => $path,
                'auto_create' => true,
            ]
        );
        $this->documentManager->publish($routeDocument, $persistedLocale);

        return $routeDocument;
    }
protected function createRoute ( $ domain , CustomUrlBehavior $ document , Localization $ locale , $ persistedLocale , $ routesPath ) { $ path = sprintf ( '%s/%s' , $ routesPath , $ domain ) ; $ routeDocument = $ this -> findOrCreateRoute ( $ path , $ persistedLocale , $ document , $ domain ) ; $ routeDocument -> setTargetDocument ( $ document ) ; $ routeDocument -> setLocale ( $ locale -> getLocale ( ) ) ; $ routeDocument -> setHistory ( false ) ; $ this -> documentManager -> persist ( $ routeDocument , $ persistedLocale , [ 'path' => $ path , 'auto_create' => true , ] ) ; $ this -> documentManager -> publish ( $ routeDocument , $ persistedLocale ) ; return $ routeDocument ; }
Create route-document for given domain.

@param string $domain
@param CustomUrlBehavior $document
@param Localization $locale
@param string $persistedLocale
@param string $routesPath

@return RouteDocument

@throws ResourceLocatorAlreadyExistsException
Create route - document for given domain .