Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
public function countByWorkspace(Workspace $workspace)
    {
        $query = $this->createQuery();
        $nodesInDatabase = $query->matching($query->equals('workspace', $workspace))->execute()->count();

        $nodesInMemory = 0;
        /** @var $node NodeData */
        foreach ($this->addedNodes as $node) {
            if ($node->getWorkspace()->getName() === $workspace->getName()) {
                $nodesInMemory++;
            }
        }

        return $nodesInDatabase + $nodesInMemory;
    }
public function countByWorkspace(Workspace $workspace)
    {
        $query = $this->createQuery();
        $nodesInDatabase = $query->matching($query->equals('workspace', $workspace))->execute()->count();

        $nodesInMemory = 0;
        /** @var $node NodeData */
        foreach ($this->addedNodes as $node) {
            if ($node->getWorkspace()->getName() === $workspace->getName()) {
                $nodesInMemory++;
            }
        }

        return $nodesInDatabase + $nodesInMemory;
    }
public function countByWorkspace ( Workspace $ workspace ) { $ query = $ this -> createQuery ( ) ; $ nodesInDatabase = $ query -> matching ( $ query -> equals ( 'workspace' , $ workspace ) ) -> execute ( ) -> count ( ) ; $ nodesInMemory = 0 ; /** @var $node NodeData */ foreach ( $ this -> addedNodes as $ node ) { if ( $ node -> getWorkspace ( ) -> getName ( ) === $ workspace -> getName ( ) ) { $ nodesInMemory ++ ; } } return $ nodesInDatabase + $ nodesInMemory ; }
Counts the number of nodes within the specified workspace

Note: Also counts removed nodes

@param Workspace $workspace The containing workspace
@return integer The number of nodes found
Counts the number of nodes within the specified workspace