protected function getPageIdsFromCurrentDepthAndCallRecursive(int $maxDepth, int $recursionRootPageId, array $pageIds, string $initialPagesAdditionalWhereClause = '')
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));

        $queryBuilder
            ->select('uid')
            ->from($this->table)
            ->where(
                $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($recursionRootPageId, \PDO::PARAM_INT))
            );

        $this->addDefaultLanguageUidConstraint($queryBuilder);

        if (!empty($initialPagesAdditionalWhereClause)) {
            $queryBuilder->andWhere($initialPagesAdditionalWhereClause);
        }

        $resultSet = $queryBuilder->execute();
        while ($page = $resultSet->fetch()) {
            $pageIds[] = $page['uid'];

            if ($maxDepth > 1) {
                $pageIds = array_merge($pageIds, $this->findAllSubPageIdsByRootPage($page['uid'], $maxDepth - 1));
            }
        }

        return $pageIds;
    }
protected function getPageIdsFromCurrentDepthAndCallRecursive(int $maxDepth, int $recursionRootPageId, array $pageIds, string $initialPagesAdditionalWhereClause = '')
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));

        $queryBuilder
            ->select('uid')
            ->from($this->table)
            ->where(
                $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($recursionRootPageId, \PDO::PARAM_INT))
            );

        $this->addDefaultLanguageUidConstraint($queryBuilder);

        if (!empty($initialPagesAdditionalWhereClause)) {
            $queryBuilder->andWhere($initialPagesAdditionalWhereClause);
        }

        $resultSet = $queryBuilder->execute();
        while ($page = $resultSet->fetch()) {
            $pageIds[] = $page['uid'];

            if ($maxDepth > 1) {
                $pageIds = array_merge($pageIds, $this->findAllSubPageIdsByRootPage($page['uid'], $maxDepth - 1));
            }
        }

        return $pageIds;
    }
protected function getPageIdsFromCurrentDepthAndCallRecursive ( int $ maxDepth , int $ recursionRootPageId , array $ pageIds , string $ initialPagesAdditionalWhereClause = '' ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) -> add ( GeneralUtility :: makeInstance ( DeletedRestriction :: class ) ) ; $ queryBuilder -> select ( 'uid' ) -> from ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'pid' , $ queryBuilder -> createNamedParameter ( $ recursionRootPageId , \ PDO :: PARAM_INT ) ) ) ; $ this -> addDefaultLanguageUidConstraint ( $ queryBuilder ) ; if ( ! empty ( $ initialPagesAdditionalWhereClause ) ) { $ queryBuilder -> andWhere ( $ initialPagesAdditionalWhereClause ) ; } $ resultSet = $ queryBuilder -> execute ( ) ; while ( $ page = $ resultSet -> fetch ( ) ) { $ pageIds [ ] = $ page [ 'uid' ] ; if ( $ maxDepth > 1 ) { $ pageIds = array_merge ( $ pageIds , $ this -> findAllSubPageIdsByRootPage ( $ page [ 'uid' ] , $ maxDepth - 1 ) ) ; } } return $ pageIds ; }
This method retrieves the pages ids from the current tree level an calls getPages recursive,
when the maxDepth has not been reached.

@param int $maxDepth
@param int $recursionRootPageId
@param array $pageIds
@param string $initialPagesAdditionalWhereClause
@return array
This method retrieves the pages ids from the current tree level an calls getPages recursive when the maxDepth has not been reached .