Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
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);
            }
        }
    }
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);
            }
        }
    }
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 ) ; } } }
Discards all unpublished nodes of the given workspace.

TODO: This method needs to be optimized / implemented in collaboration with a DQL-based method in NodeDataRepository

@param Workspace $workspace The workspace to flush, can't be the live workspace
@return void
@throws WorkspaceException
@api
Discards all unpublished nodes of the given workspace .