/** * Publishes the given node to the specified targetWorkspace * * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node * @param string $targetWorkspaceName * @return void * @ExtDirect */ public function publishNodeAction(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node, $targetWorkspaceName) { /** * TODO: The publishing pushes the same node twice, which causes the node to be published * already when it's processed the second time. This obviously leads to a problem for the * Workspace object which will (in the second time) try to publish a node in the live workspace * to the baseWorkspace of the live workspace (which does not exist). */ if ($targetWorkspaceName === $node->getWorkspace()->getName()) { $this->view->assign('value', array('success' => TRUE)); return; } $this->workspacesService->publishNode($node, $targetWorkspaceName); $this->view->assign('value', array('success' => TRUE)); }
/** * @param string $workspaceName * @return void */ public function discardWorkspaceAction($workspaceName) { foreach ($this->workspacesService->getUnpublishedNodes($workspaceName) as $node) { if ($node->getPath() !== '/') { $this->nodeRepository->remove($node); } } $this->flashMessageContainer->addMessage(new \TYPO3\FLOW3\Error\Message('Changes in workspace "%s" have been discarded', NULL, array($workspaceName))); $this->redirect('index'); }