Document/Subscriber/DateShardingSubscriber.php
public function handleSetParentNode(PersistEvent $event)
    {
        if (!$event->getDocument() instanceof DateShardingBehavior || $event->hasParentNode()) {
            return;
        }

        $date = $event->getDocument()->getCreated();
        if (null === $date) {
            $date = new \DateTime();
        }

        $path = $this->pathBuilder->build(['%base%', '%articles%', $date->format('Y'), $date->format('m')]);

        $event->setParentNode($this->nodeManager->createPath($path));
    }
public function handleSetParentNode(PersistEvent $event)
    {
        if (!$event->getDocument() instanceof DateShardingBehavior || $event->hasParentNode()) {
            return;
        }

        $date = $event->getDocument()->getCreated();
        if (null === $date) {
            $date = new \DateTime();
        }

        $path = $this->pathBuilder->build(['%base%', '%articles%', $date->format('Y'), $date->format('m')]);

        $event->setParentNode($this->nodeManager->createPath($path));
    }
public function handleSetParentNode ( PersistEvent $ event ) { if ( ! $ event -> getDocument ( ) instanceof DateShardingBehavior || $ event -> hasParentNode ( ) ) { return ; } $ date = $ event -> getDocument ( ) -> getCreated ( ) ; if ( null === $ date ) { $ date = new \ DateTime ( ) ; } $ path = $ this -> pathBuilder -> build ( [ '%base%' , '%articles%' , $ date -> format ( 'Y' ) , $ date -> format ( 'm' ) ] ) ; $ event -> setParentNode ( $ this -> nodeManager -> createPath ( $ path ) ) ; }
Set parent-node if no parent exists.

The format of parent node is: /%base%/%articles%/

@param PersistEvent $event
Set parent - node if no parent exists .