Exemplo n.º 1
0
 /**
  * Schedules a document to be deindexed.
  *
  * @param RemoveEvent $event
  */
 public function handlePreRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof StructureBehavior) {
         return;
     }
     $this->searchManager->deindex($document);
 }
Exemplo n.º 2
0
 public function handlePostRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$this->supports($document)) {
         return;
     }
     $oid = spl_object_hash($document);
     $event = $this->events[$oid];
     $this->dispatcher->dispatch(ContentEvents::NODE_POST_DELETE, $event);
     unset($this->events[$oid]);
 }
 /**
  * Deregister removed documents.
  *
  * @param RemoveEvent $event
  */
 public function handleRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     $this->documentRegistry->deregisterDocument($document);
 }
Exemplo n.º 4
0
 /**
  * Removes the routes for the given document and removes history routes if necessary.
  *
  * @param RemoveEvent $event
  */
 public function handleRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof RouteBehavior) {
         return;
     }
     $this->recursivelyRemoveRoutes($document);
 }
Exemplo n.º 5
0
 /**
  * Invalidates the assigned structure and all urls in all locales of the document when a document gets removed.
  * This method is executed before the actual removing of the document because the document must still
  * exist to gather the urls of the document.
  *
  * @param RemoveEvent $event
  */
 public function invalidateDocumentBeforeRemoving(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if ($document instanceof StructureBehavior) {
         $this->invalidateDocumentStructure($document);
     }
     if ($document instanceof ResourceSegmentBehavior) {
         foreach ($this->documentInspector->getPublishedLocales($document) as $locale) {
             $this->invalidateDocumentUrls($document, $locale);
         }
     }
 }
Exemplo n.º 6
0
 /**
  * Schedules a document to be deindexed.
  *
  * @param RemoveEvent $event
  */
 public function deindexRemovedDocument(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof StructureBehavior) {
         return;
     }
     if (!$document instanceof WorkflowStageBehavior) {
         $this->searchManager->deindex($document);
     } else {
         $workflowStage = $document->getWorkflowStage();
         foreach (WorkflowStage::$stages as $stage) {
             $document->setWorkflowStage($stage);
             $this->searchManager->deindex($document);
         }
         $document->setWorkflowStage($workflowStage);
     }
 }
 /**
  * Remove the given documents node from PHPCR session and optionally
  * remove any references to the node.
  *
  * @param RemoveEvent $event
  */
 public function handleRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     $node = $this->documentRegistry->getNodeForDocument($document);
     $node->remove();
 }
Exemplo n.º 8
0
 /**
  * Removes the routes for the given document.
  *
  * @param RemoveEvent $event
  */
 public function handleRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof CustomUrlBehavior) {
         return;
     }
     foreach ($this->inspector->getReferrers($document) as $referrer) {
         if ($referrer instanceof RouteBehavior) {
             $this->documentManager->remove($referrer);
         }
     }
 }
 /**
  * It should deregister the document on the REMOVE event.
  */
 public function testHandleRemove()
 {
     $this->removeEvent->getDocument()->willReturn($this->document);
     $this->registry->deregisterDocument($this->document)->shouldBeCalled();
     $this->subscriber->handleRemove($this->removeEvent->reveal());
 }
Exemplo n.º 10
0
 public function handleRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     $this->removeDocument($document);
 }
Exemplo n.º 11
0
 /**
  * Since deleting is not draftable the node will be deleted in the live session as soon as it is deleted in the
  * default session.
  *
  * @param RemoveEvent $event
  */
 public function removeNodeFromPublicWorkspace(RemoveEvent $event)
 {
     $this->getLiveNode($event->getDocument())->remove();
 }