public function findNodesByPathPrefixAndRelatedEntities($pathPrefix, $relationMap)
    {
        $queryBuilder = $this->buildQueryBuilderForRelationMap($relationMap);

        if (trim($pathPrefix) !== '') {
            $queryBuilder->andWhere('n.path LIKE :pathPrefix');
            $queryBuilder->setParameter('pathPrefix', trim($pathPrefix) . '%');
        }

        return $queryBuilder->getQuery()->getResult();
    }