public function findOneClosestPageIdWithActiveTemplateByRootLine(array $rootLine)
    {
        $rootLinePageIds = [0];
        foreach ($rootLine as $rootLineItem) {
            $rootLinePageIds[] = (int)$rootLineItem['uid'];
        }

        $queryBuilder = $this->getQueryBuilder();

        $result = $queryBuilder
            ->select('uid', 'pid')
            ->from($this->table)
            ->where($queryBuilder->expr()->in('pid', $rootLinePageIds))
            ->execute()->fetch();

        return isset($result['pid']) ? $result['pid'] : 0;
    }
public function findOneClosestPageIdWithActiveTemplateByRootLine(array $rootLine)
    {
        $rootLinePageIds = [0];
        foreach ($rootLine as $rootLineItem) {
            $rootLinePageIds[] = (int)$rootLineItem['uid'];
        }

        $queryBuilder = $this->getQueryBuilder();

        $result = $queryBuilder
            ->select('uid', 'pid')
            ->from($this->table)
            ->where($queryBuilder->expr()->in('pid', $rootLinePageIds))
            ->execute()->fetch();

        return isset($result['pid']) ? $result['pid'] : 0;
    }
public function findOneClosestPageIdWithActiveTemplateByRootLine ( array $ rootLine ) { $ rootLinePageIds = [ 0 ] ; foreach ( $ rootLine as $ rootLineItem ) { $ rootLinePageIds [ ] = ( int ) $ rootLineItem [ 'uid' ] ; } $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ result = $ queryBuilder -> select ( 'uid' , 'pid' ) -> from ( $ this -> table ) -> where ( $ queryBuilder -> expr ( ) -> in ( 'pid' , $ rootLinePageIds ) ) -> execute ( ) -> fetch ( ) ; return isset ( $ result [ 'pid' ] ) ? $ result [ 'pid' ] : 0 ; }
Finds a first closest page id with active template.

This method expects one startPageId, which must be inside the root line and does not check if it is one in the root line.

@param array $rootLine
@return int
Finds a first closest page id with active template .