Document/Subscriber/ArticleSubscriber.php
public function synchronizeChildren(PublishEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $liveNode = $event->getNode();
        $draftNode = $this->documentInspector->getNode($document);

        $liveChildren = $this->getChildren($liveNode);
        $draftChildren = $this->getChildren($draftNode);
        $removedChildrenIds = array_diff(array_keys($liveChildren), array_keys($draftChildren));

        foreach ($removedChildrenIds as $removedChildrenId) {
            $liveChildren[$removedChildrenId]->remove();
        }
    }
public function synchronizeChildren(PublishEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $liveNode = $event->getNode();
        $draftNode = $this->documentInspector->getNode($document);

        $liveChildren = $this->getChildren($liveNode);
        $draftChildren = $this->getChildren($draftNode);
        $removedChildrenIds = array_diff(array_keys($liveChildren), array_keys($draftChildren));

        foreach ($removedChildrenIds as $removedChildrenId) {
            $liveChildren[$removedChildrenId]->remove();
        }
    }
public function synchronizeChildren ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ArticleDocument ) { return ; } $ liveNode = $ event -> getNode ( ) ; $ draftNode = $ this -> documentInspector -> getNode ( $ document ) ; $ liveChildren = $ this -> getChildren ( $ liveNode ) ; $ draftChildren = $ this -> getChildren ( $ draftNode ) ; $ removedChildrenIds = array_diff ( array_keys ( $ liveChildren ) , array_keys ( $ draftChildren ) ) ; foreach ( $ removedChildrenIds as $ removedChildrenId ) { $ liveChildren [ $ removedChildrenId ] -> remove ( ) ; } }
Syncs children between live and draft.

@param PublishEvent $event
Syncs children between live and draft .