/** * Find all nodes of the specified workspace lying below the path specified by * (and including) the given starting point. * * @param string $pathStartingPoint Absolute path specifying the starting point * @param string $workspace The containing workspace * @param string $nodeTypeFilter * @return array an array of node-data in array format. */ protected function findNodeDataListToExport($pathStartingPoint, $workspace = 'live', $nodeTypeFilter = null) { /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */ $queryBuilder = $this->entityManager->createQueryBuilder(); $queryBuilder->select('n.path AS path,' . ' n.identifier AS identifier,' . ' n.index AS sortingIndex,' . ' n.properties AS properties, ' . ' n.nodeType AS nodeType,' . ' n.removed AS removed,' . ' n.hidden,' . ' n.hiddenBeforeDateTime AS hiddenBeforeDateTime,' . ' n.hiddenAfterDateTime AS hiddenAfterDateTime,' . ' n.creationDateTime AS creationDateTime,' . ' n.lastModificationDateTime AS lastModificationDateTime,' . ' n.lastPublicationDateTime AS lastPublicationDateTime,' . ' n.hiddenInIndex AS hiddenInIndex,' . ' n.accessRoles AS accessRoles,' . ' n.version AS version,' . ' n.parentPath AS parentPath,' . ' n.pathHash AS pathHash,' . ' n.dimensionsHash AS dimensionsHash,' . ' n.parentPathHash AS parentPathHash,' . ' n.dimensionValues AS dimensionValues,' . ' w.name AS workspace')->distinct()->from('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', 'n')->innerJoin('n.workspace', 'w', 'WITH', 'n.workspace=w.name')->where('n.workspace = :workspace')->setParameter('workspace', $workspace)->andWhere('n.path = :pathPrefix OR n.path LIKE :pathPrefixMatch')->setParameter('pathPrefix', $pathStartingPoint)->setParameter('pathPrefixMatch', $pathStartingPoint === '/' ? '%' : $pathStartingPoint . '/%')->orderBy('n.identifier', 'ASC')->orderBy('n.path', 'ASC'); if ($nodeTypeFilter) { $this->nodeDataRepository->addNodeTypeFilterConstraintsToQueryBuilder($queryBuilder, $nodeTypeFilter); } $nodeDataList = $queryBuilder->getQuery()->getResult(); // Sort nodeDataList by path, replacing "/" with "!" (the first visible ASCII character) // because there may be characters like "-" in the node path // that would break the sorting order usort($nodeDataList, function ($node1, $node2) { return strcmp(str_replace("/", "!", $node1['path']), str_replace("/", "!", $node2['path'])); }); return $nodeDataList; }