/** * Helper method to inform the client, that new workspace information is available * * @return void */ protected function updateWorkspaceInfo() { $nodeService = new NodeService(); $updateWorkspaceInfo = new UpdateWorkspaceInfo(); $updateWorkspaceInfo->setDocument($nodeService->getClosestDocument($this->getSubject())); $this->feedbackCollection->add($updateWorkspaceInfo); }
/** * Discard nodes * * @param array $nodeContextPaths * @return void */ public function discardAction(array $nodeContextPaths) { try { foreach ($nodeContextPaths as $contextPath) { $node = $this->nodeService->getNodeFromContextPath($contextPath); $this->publishingService->discardNode($node); $reloadDocument = new ReloadDocument(); $reloadDocument->setDocument($this->nodeService->getClosestDocument($node)); $this->feedbackCollection->add($reloadDocument); } $success = new Success(); $success->setMessage(sprintf('Discarded %d node(s).', count($nodeContextPaths))); $this->updateWorkspaceInfo($nodeContextPaths[0]); $this->feedbackCollection->add($success); $this->persistenceManager->persistAll(); } catch (\Exception $e) { $error = new Error(); $error->setMessage($e->getMessage()); $this->feedbackCollection->add($error); } $this->view->assign('value', $this->feedbackCollection); }