Neos\ContentRepository\Domain\Repository\NodeDataRepository::pathExists PHP Method

pathExists() public method

Find out if the given path exists anywhere in the CR. (internal) If you need this functionality use \Neos\ContentRepository\Domain\Service\NodeService::nodePathExistsInAnyContext()
public pathExists ( string $nodePath ) : boolean
$nodePath string
return boolean
    public function pathExists($nodePath)
    {
        $nodePath = strtolower($nodePath);
        $result = null;
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $this->securityContext->withoutAuthorizationChecks(function () use($nodePath, $queryBuilder, &$result) {
            $queryBuilder->select('n.identifier')->from(NodeData::class, 'n')->where('n.pathHash = :pathHash')->setParameter('pathHash', md5($nodePath));
            $result = count($queryBuilder->getQuery()->getResult()) > 0 ? true : false;
        });
        return $result;
    }