Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
protected function findNextHigherIndex($parentPath, $referenceIndex)
    {
        if (isset($this->highestIndexCache[$parentPath]) && $this->highestIndexCache[$parentPath] === $referenceIndex) {
            null;
        }
        $this->persistEntities();
        /** @var \Doctrine\ORM\Query $query */
        $query = $this->entityManager->createQuery('SELECT MIN(n.index) FROM Neos\ContentRepository\Domain\Model\NodeData n WHERE n.parentPathHash = :parentPathHash AND n.index > :referenceIndex');
        $query->setParameter('parentPathHash', md5($parentPath));
        $query->setParameter('referenceIndex', $referenceIndex);

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

        return $query->getSingleScalarResult() ?: null;
    }
protected function findNextHigherIndex ( $ parentPath , $ referenceIndex ) { if ( isset ( $ this -> highestIndexCache [ $ parentPath ] ) && $ this -> highestIndexCache [ $ parentPath ] === $ referenceIndex ) { null ; } $ this -> persistEntities ( ) ; /** @var \Doctrine\ORM\Query $query */ $ query = $ this -> entityManager -> createQuery ( 'SELECT MIN(n.index) FROM Neos\ContentRepository\Domain\Model\NodeData n WHERE n.parentPathHash = :parentPathHash AND n.index > :referenceIndex' ) ; $ query -> setParameter ( 'parentPathHash' , md5 ( $ parentPath ) ) ; $ query -> setParameter ( 'referenceIndex' , $ referenceIndex ) ; return $ query -> getSingleScalarResult ( ) ? : null ; }
Returns the next-higher-index seen from the given reference index in the
level below the specified parent path. If no node with a higher than the
given index exists at that level, NULL is returned.

The result is determined workspace-agnostic.

@param string $parentPath Path of the parent node specifying the level in the node tree
@param integer $referenceIndex Index of a known node
@return integer The currently next higher index or NULL if no node with a higher index exists
Returns the next - higher - index seen from the given reference index in the level below the specified parent path . If no node with a higher than the given index exists at that level NULL is returned .