Document/Subscriber/RoutableSubscriber.php
public function handlePersist(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutablePageBehavior) {
            return;
        }

        $document->setUuid($event->getNode()->getIdentifier());

        $propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale());
        $routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);

        $route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($document, $routePath));
        $document->setRoutePath($route->getPath());

        $event->getNode()->setProperty($propertyName, $route->getPath());

        if (!$document instanceof ChildrenBehavior) {
            return;
        }

        foreach ($document->getChildren() as $child) {
            if (!$child instanceof RoutablePageBehavior) {
                continue;
            }

            $route = $this->chainRouteGenerator->generate($child);
            $child->setRoutePath($route->getPath());

            $node = $this->documentInspector->getNode($child);
            $node->setProperty($propertyName, $route->getPath());
        }
    }
public function handlePersist(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutablePageBehavior) {
            return;
        }

        $document->setUuid($event->getNode()->getIdentifier());

        $propertyName = $this->getRoutePathPropertyName($document->getStructureType(), $event->getLocale());
        $routePath = $event->getNode()->getPropertyValueWithDefault($propertyName, null);

        $route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($document, $routePath));
        $document->setRoutePath($route->getPath());

        $event->getNode()->setProperty($propertyName, $route->getPath());

        if (!$document instanceof ChildrenBehavior) {
            return;
        }

        foreach ($document->getChildren() as $child) {
            if (!$child instanceof RoutablePageBehavior) {
                continue;
            }

            $route = $this->chainRouteGenerator->generate($child);
            $child->setRoutePath($route->getPath());

            $node = $this->documentInspector->getNode($child);
            $node->setProperty($propertyName, $route->getPath());
        }
    }
public function handlePersist ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof RoutablePageBehavior ) { return ; } $ document -> setUuid ( $ event -> getNode ( ) -> getIdentifier ( ) ) ; $ propertyName = $ this -> getRoutePathPropertyName ( $ document -> getStructureType ( ) , $ event -> getLocale ( ) ) ; $ routePath = $ event -> getNode ( ) -> getPropertyValueWithDefault ( $ propertyName , null ) ; $ route = $ this -> conflictResolver -> resolve ( $ this -> chainRouteGenerator -> generate ( $ document , $ routePath ) ) ; $ document -> setRoutePath ( $ route -> getPath ( ) ) ; $ event -> getNode ( ) -> setProperty ( $ propertyName , $ route -> getPath ( ) ) ; if ( ! $ document instanceof ChildrenBehavior ) { return ; } foreach ( $ document -> getChildren ( ) as $ child ) { if ( ! $ child instanceof RoutablePageBehavior ) { continue ; } $ route = $ this -> chainRouteGenerator -> generate ( $ child ) ; $ child -> setRoutePath ( $ route -> getPath ( ) ) ; $ node = $ this -> documentInspector -> getNode ( $ child ) ; $ node -> setProperty ( $ propertyName , $ route -> getPath ( ) ) ; } }
Generate route and save route-path.

@param AbstractMappingEvent $event
Generate route and save route - path .