src/Sulu/Bundle/PageBundle/Search/EventSubscriber/StructureSubscriber.php
public function indexDocumentAfterRemoveDraft(RemoveDraftEvent $event)
    {
        $document = $event->getDocument();

        if ($document instanceof WorkflowStageBehavior) {
            // Set the workflowstage to test for indexing, because the wrong index will be updated otherwise
            $document->setWorkflowStage(WorkflowStage::TEST);
        }

        $this->indexDocument($document);

        if ($document instanceof WorkflowStageBehavior) {
            // Reset the workflowstage to published, because after removing a draft the document will always be in
            // the published state
            $document->setWorkflowStage(WorkflowStage::PUBLISHED);
        }
    }
public function indexDocumentAfterRemoveDraft(RemoveDraftEvent $event)
    {
        $document = $event->getDocument();

        if ($document instanceof WorkflowStageBehavior) {
            // Set the workflowstage to test for indexing, because the wrong index will be updated otherwise
            $document->setWorkflowStage(WorkflowStage::TEST);
        }

        $this->indexDocument($document);

        if ($document instanceof WorkflowStageBehavior) {
            // Reset the workflowstage to published, because after removing a draft the document will always be in
            // the published state
            $document->setWorkflowStage(WorkflowStage::PUBLISHED);
        }
    }
public function indexDocumentAfterRemoveDraft ( RemoveDraftEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( $ document instanceof WorkflowStageBehavior ) { // Set the workflowstage to test for indexing, because the wrong index will be updated otherwise $ document -> setWorkflowStage ( WorkflowStage :: TEST ) ; } $ this -> indexDocument ( $ document ) ; if ( $ document instanceof WorkflowStageBehavior ) { // Reset the workflowstage to published, because after removing a draft the document will always be in // the published state $ document -> setWorkflowStage ( WorkflowStage :: PUBLISHED ) ; } }
Indexes a document after its draft have been removed.

@param RemoveDraftEvent $event
Indexes a document after its draft have been removed .