public discardAllNodes ( |
||
$workspace | The workspace to flush, can't be the live workspace | |
return | void |
public function discardAllNodes(Workspace $workspace)
{
if ($workspace->getName() === 'live') {
throw new WorkspaceException('Nodes in the live workspace cannot be discarded.', 1428937112);
}
foreach ($this->getUnpublishedNodes($workspace) as $node) {
/** @var NodeInterface $node */
if ($node->getPath() !== '/') {
$this->discardNode($node);
}
}
}