src/Sulu/Component/Rest/ListBuilder/Doctrine/DoctrineListBuilder.php
protected function findIdsByGivenCriteria()
    {
        $select = $this->getSelectAs($this->idField);

        $subQueryBuilder = $this->createSubQueryBuilder($select);
        if (null != $this->limit) {
            $subQueryBuilder->setMaxResults($this->limit)->setFirstResult($this->limit * ($this->page - 1));
        }

        foreach ($this->sortFields as $index => $sortField) {
            if ($sortField->getName() !== $this->idField->getName()) {
                $subQueryBuilder->addSelect($this->getSelectAs($sortField));
            }
        }

        $this->assignSortFields($subQueryBuilder);
        $this->assignParameters($this->queryBuilder);
        $ids = $subQueryBuilder->getQuery()->getArrayResult();

        // if no results are found - return
        if (count($ids) < 1) {
            return [];
        }

        $ids = array_map(
            function($array) {
                return $array[$this->idField->getName()];
            },
            $ids
        );

        return $ids;
    }
protected function findIdsByGivenCriteria()
    {
        $select = $this->getSelectAs($this->idField);

        $subQueryBuilder = $this->createSubQueryBuilder($select);
        if (null != $this->limit) {
            $subQueryBuilder->setMaxResults($this->limit)->setFirstResult($this->limit * ($this->page - 1));
        }

        foreach ($this->sortFields as $index => $sortField) {
            if ($sortField->getName() !== $this->idField->getName()) {
                $subQueryBuilder->addSelect($this->getSelectAs($sortField));
            }
        }

        $this->assignSortFields($subQueryBuilder);
        $this->assignParameters($this->queryBuilder);
        $ids = $subQueryBuilder->getQuery()->getArrayResult();

        // if no results are found - return
        if (count($ids) < 1) {
            return [];
        }

        $ids = array_map(
            function($array) {
                return $array[$this->idField->getName()];
            },
            $ids
        );

        return $ids;
    }
protected function findIdsByGivenCriteria ( ) { $ select = $ this -> getSelectAs ( $ this -> idField ) ; $ subQueryBuilder = $ this -> createSubQueryBuilder ( $ select ) ; if ( null != $ this -> limit ) { $ subQueryBuilder -> setMaxResults ( $ this -> limit ) -> setFirstResult ( $ this -> limit * ( $ this -> page - 1 ) ) ; } foreach ( $ this -> sortFields as $ index => $ sortField ) { if ( $ sortField -> getName ( ) !== $ this -> idField -> getName ( ) ) { $ subQueryBuilder -> addSelect ( $ this -> getSelectAs ( $ sortField ) ) ; } } $ this -> assignSortFields ( $ subQueryBuilder ) ; $ this -> assignParameters ( $ this -> queryBuilder ) ; $ ids = $ subQueryBuilder -> getQuery ( ) -> getArrayResult ( ) ; // if no results are found - return if ( count ( $ ids ) < 1 ) { return [ ] ; } $ ids = array_map ( function ( $ array ) { return $ array [ $ this -> idField -> getName ( ) ] ; } , $ ids ) ; return $ ids ; }
Function that finds all IDs of entities that match the
search criteria.

@return array
Function that finds all IDs of entities that match the search criteria .