/** * Resets the workflowstage to test and the published date to null. * * @param UnpublishEvent $event */ public function setWorkflowStageToTestAndResetPublishedDate(UnpublishEvent $event) { $document = $event->getDocument(); if (!$this->supports($event)) { return; } $locale = $event->getLocale(); $node = $this->defaultSession->getNode($this->documentInspector->getPath($document)); $node->setProperty($this->propertyEncoder->localizedSystemName(self::WORKFLOW_STAGE_FIELD, $locale), WorkflowStage::TEST); $node->setProperty($this->propertyEncoder->localizedSystemName(self::PUBLISHED_FIELD, $locale), null); }
/** * Deindexes the document from the search index for the website. * * @param UnpublishEvent $event */ public function deindexUnpublishedDocument(UnpublishEvent $event) { $document = $event->getDocument(); if (!$document instanceof StructureBehavior) { return; } $this->searchManager->deindex($document); }
/** * Invalidates the assigned structure and all urls in the locale of the document when a document gets unpublished. * This method is executed before the actual unpublishing of the document because the document must still * be published to gather the urls of the document. * * @param UnpublishEvent $event */ public function invalidateDocumentBeforeUnpublishing(UnpublishEvent $event) { $document = $event->getDocument(); if ($document instanceof StructureBehavior) { $this->invalidateDocumentStructure($document); } if ($document instanceof ResourceSegmentBehavior && $document instanceof WorkflowStageBehavior && $document->getPublished()) { $this->invalidateDocumentUrls($document, $this->documentInspector->getLocale($document)); } }
/** * Sets the node from the live workspace on the given event. * * @param PublishEvent|UnpublishEvent $event */ private function setNodeFromPublicWorkspace($event) { $event->setNode($this->getLiveNode($event->getDocument())); }