protected function findNextLowerIndex($parentPath, $referenceIndex)
    {
        $this->persistEntities();
        /** @var \Doctrine\ORM\Query $query */
        $query = $this->entityManager->createQuery('SELECT MAX(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() ?: 0;
    }
protected function findNextLowerIndex($parentPath, $referenceIndex)
    {
        $this->persistEntities();
        /** @var \Doctrine\ORM\Query $query */
        $query = $this->entityManager->createQuery('SELECT MAX(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() ?: 0;
    }
protected function findNextLowerIndex ( $ parentPath , $ referenceIndex ) { $ this -> persistEntities ( ) ; /** @var \Doctrine\ORM\Query $query */ $ query = $ this -> entityManager -> createQuery ( 'SELECT MAX(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 ( ) ? : 0 ; }
Returns the next-lower-index seen from the given reference index in the
level below the specified parent path. If no node with a lower than the
given index exists at that level, the reference index 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 lower index
Returns the next - lower - index seen from the given reference index in the level below the specified parent path . If no node with a lower than the given index exists at that level the reference index is returned .