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

        foreach ($document->getChildren() as $child) {
            if (LocalizationState::GHOST === $this->documentInspector->getLocalizationState($child)) {
                continue;
            }

            try {
                $this->documentManager->removeDraft($child, $event->getLocale());
            } catch (PathNotFoundException $exception) {
                // child is not available in live workspace
                $node = $this->documentInspector->getNode($child);
                $node->remove();
            }
        }
    }
public function removeDraftChildren(RemoveDraftEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        foreach ($document->getChildren() as $child) {
            if (LocalizationState::GHOST === $this->documentInspector->getLocalizationState($child)) {
                continue;
            }

            try {
                $this->documentManager->removeDraft($child, $event->getLocale());
            } catch (PathNotFoundException $exception) {
                // child is not available in live workspace
                $node = $this->documentInspector->getNode($child);
                $node->remove();
            }
        }
    }
public function removeDraftChildren ( RemoveDraftEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ArticleDocument ) { return ; } foreach ( $ document -> getChildren ( ) as $ child ) { if ( LocalizationState :: GHOST === $ this -> documentInspector -> getLocalizationState ( $ child ) ) { continue ; } try { $ this -> documentManager -> removeDraft ( $ child , $ event -> getLocale ( ) ) ; } catch ( PathNotFoundException $ exception ) { // child is not available in live workspace $ node = $ this -> documentInspector -> getNode ( $ child ) ; $ node -> remove ( ) ; } } }
Remove draft from children.

@param RemoveDraftEvent $event
Remove draft from children .