src/Sulu/Component/CustomUrl/Document/Subscriber/CustomUrlSubscriber.php
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!($document instanceof CustomUrlBehavior)) {
            return;
        }

        $webspaceKey = $this->inspector->getWebspace($document);
        $domain = $this->generator->generate($document->getBaseDomain(), $document->getDomainParts());
        $locale = $this->webspaceManager->findWebspaceByKey($webspaceKey)->getLocalization(
            $document->getTargetLocale()
        );
        $route = $this->createRoute(
            $domain,
            $document,
            $locale,
            $event->getLocale(),
            $this->getRoutesPath($webspaceKey)
        );

        $this->updateOldReferrers($document, $route, $event->getLocale());
    }
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!($document instanceof CustomUrlBehavior)) {
            return;
        }

        $webspaceKey = $this->inspector->getWebspace($document);
        $domain = $this->generator->generate($document->getBaseDomain(), $document->getDomainParts());
        $locale = $this->webspaceManager->findWebspaceByKey($webspaceKey)->getLocalization(
            $document->getTargetLocale()
        );
        $route = $this->createRoute(
            $domain,
            $document,
            $locale,
            $event->getLocale(),
            $this->getRoutesPath($webspaceKey)
        );

        $this->updateOldReferrers($document, $route, $event->getLocale());
    }
public function handlePersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! ( $ document instanceof CustomUrlBehavior ) ) { return ; } $ webspaceKey = $ this -> inspector -> getWebspace ( $ document ) ; $ domain = $ this -> generator -> generate ( $ document -> getBaseDomain ( ) , $ document -> getDomainParts ( ) ) ; $ locale = $ this -> webspaceManager -> findWebspaceByKey ( $ webspaceKey ) -> getLocalization ( $ document -> getTargetLocale ( ) ) ; $ route = $ this -> createRoute ( $ domain , $ document , $ locale , $ event -> getLocale ( ) , $ this -> getRoutesPath ( $ webspaceKey ) ) ; $ this -> updateOldReferrers ( $ document , $ route , $ event -> getLocale ( ) ) ; }
Creates routes for persisted custom-url.

@param PersistEvent $event
Creates routes for persisted custom - url .