Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
protected function findNextFreeIndexInParentPath($parentPath)
    {
        if (!isset($this->highestIndexCache[$parentPath])) {
            /** @var \Doctrine\ORM\Query $query */
            $query = $this->entityManager->createQuery('SELECT MAX(n.index) FROM Neos\ContentRepository\Domain\Model\NodeData n WHERE n.parentPathHash = :parentPathHash');
            $query->setParameter('parentPathHash', md5($parentPath));
            $this->highestIndexCache[$parentPath] = $query->getSingleScalarResult() ?: 0;
        }

        $this->highestIndexCache[$parentPath] += 100;

        return $this->highestIndexCache[$parentPath];
    }
protected function findNextFreeIndexInParentPath($parentPath)
    {
        if (!isset($this->highestIndexCache[$parentPath])) {
            /** @var \Doctrine\ORM\Query $query */
            $query = $this->entityManager->createQuery('SELECT MAX(n.index) FROM Neos\ContentRepository\Domain\Model\NodeData n WHERE n.parentPathHash = :parentPathHash');
            $query->setParameter('parentPathHash', md5($parentPath));
            $this->highestIndexCache[$parentPath] = $query->getSingleScalarResult() ?: 0;
        }

        $this->highestIndexCache[$parentPath] += 100;

        return $this->highestIndexCache[$parentPath];
    }
protected function findNextFreeIndexInParentPath ( $ parentPath ) { if ( ! isset ( $ this -> highestIndexCache [ $ parentPath ] ) ) { /** @var \Doctrine\ORM\Query $query */ $ query = $ this -> entityManager -> createQuery ( 'SELECT MAX(n.index) FROM Neos\ContentRepository\Domain\Model\NodeData n WHERE n.parentPathHash = :parentPathHash' ) ; $ query -> setParameter ( 'parentPathHash' , md5 ( $ parentPath ) ) ; $ this -> highestIndexCache [ $ parentPath ] = $ query -> getSingleScalarResult ( ) ? : 0 ; } $ this -> highestIndexCache [ $ parentPath ] += 100 ; return $ this -> highestIndexCache [ $ parentPath ] ; }
Finds the next free index on the level below the given parent path
across all workspaces.

@param string $parentPath Path of the parent node specifying the level in the node tree
@return integer The next available index
Finds the next free index on the level below the given parent path across all workspaces .