Neos\ContentRepository\Domain\Service\PublishingService::discardAllNodes PHP Method

discardAllNodes() public method

TODO: This method needs to be optimized / implemented in collaboration with a DQL-based method in NodeDataRepository
public discardAllNodes ( Workspace $workspace ) : void
$workspace Neos\ContentRepository\Domain\Model\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);
            }
        }
    }