Document/Subscriber/ArticlePageSubscriber.php
public function setNodeOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument || $event->hasNode()) {
            return;
        }

        $pageTitle = $this->getPageTitle($document);

        // if no page-title exists use a unique-id
        $nodeName = $this->slugifier->slugify($pageTitle ?: uniqid('page-', true));
        $nodeName = $this->resolver->resolveName($event->getParentNode(), $nodeName);
        $node = $event->getParentNode()->addNode($nodeName);

        $event->setNode($node);
    }
public function setNodeOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument || $event->hasNode()) {
            return;
        }

        $pageTitle = $this->getPageTitle($document);

        // if no page-title exists use a unique-id
        $nodeName = $this->slugifier->slugify($pageTitle ?: uniqid('page-', true));
        $nodeName = $this->resolver->resolveName($event->getParentNode(), $nodeName);
        $node = $event->getParentNode()->addNode($nodeName);

        $event->setNode($node);
    }
public function setNodeOnPersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ArticlePageDocument || $ event -> hasNode ( ) ) { return ; } $ pageTitle = $ this -> getPageTitle ( $ document ) ; // if no page-title exists use a unique-id $ nodeName = $ this -> slugifier -> slugify ( $ pageTitle ? : uniqid ( 'page-' , true ) ) ; $ nodeName = $ this -> resolver -> resolveName ( $ event -> getParentNode ( ) , $ nodeName ) ; $ node = $ event -> getParentNode ( ) -> addNode ( $ nodeName ) ; $ event -> setNode ( $ node ) ; }
Set node to event on persist.

@param PersistEvent $event
Set node to event on persist .