protected function selectQueryBuilder(
        array $columns = null,
        array $criteria = null,
        array $orderBy = null,
        int $limit = null,
        int $offset = null
    ): QueryBuilder {
        // Create a new query
        $query = $this->entityManager
            ->getQueryBuilder()
            ->select($columns)
            ->table($this->table);

        // If criteria has been passed
        if (null !== $criteria) {
            $this->setCriteriaInQuery($query, $criteria);
        }

        // If order by has been passed
        if (null !== $orderBy) {
            $this->setOrderByInQuery($query, $orderBy);
        }

        // If a limit is passed
        if (null !== $limit) {
            $this->setLimitInQuery($query, $limit);
        }

        // If an offset is passed
        if (null !== $offset) {
            $this->setOffsetInQuery($query, $offset);
        }

        return $query;
    }
protected function selectQueryBuilder(
        array $columns = null,
        array $criteria = null,
        array $orderBy = null,
        int $limit = null,
        int $offset = null
    ): QueryBuilder {
        // Create a new query
        $query = $this->entityManager
            ->getQueryBuilder()
            ->select($columns)
            ->table($this->table);

        // If criteria has been passed
        if (null !== $criteria) {
            $this->setCriteriaInQuery($query, $criteria);
        }

        // If order by has been passed
        if (null !== $orderBy) {
            $this->setOrderByInQuery($query, $orderBy);
        }

        // If a limit is passed
        if (null !== $limit) {
            $this->setLimitInQuery($query, $limit);
        }

        // If an offset is passed
        if (null !== $offset) {
            $this->setOffsetInQuery($query, $offset);
        }

        return $query;
    }
protected function selectQueryBuilder ( array $ columns = null , array $ criteria = null , array $ orderBy = null , int $ limit = null , int $ offset = null ) : QueryBuilder { // Create a new query $ query = $ this -> entityManager -> getQueryBuilder ( ) -> select ( $ columns ) -> table ( $ this -> table ) ; // If criteria has been passed if ( null !== $ criteria ) { $ this -> setCriteriaInQuery ( $ query , $ criteria ) ; } // If order by has been passed if ( null !== $ orderBy ) { $ this -> setOrderByInQuery ( $ query , $ orderBy ) ; } // If a limit is passed if ( null !== $ limit ) { $ this -> setLimitInQuery ( $ query , $ limit ) ; } // If an offset is passed if ( null !== $ offset ) { $ this -> setOffsetInQuery ( $ query , $ offset ) ; } return $ query ; }
Build a select query statement by given criteria.

<code>
$this->queryBuilder(
[
'column',
'column2',
],
[
'column'  => 'value',
'column2' => 'value2',
],
[
'column'
'column2' => OrderBy::ASC,
'column3' => OrderBy::DESC,
],
1,
1
)
</code>

@param array|null $columns
@param array|null $criteria
@param array|null $orderBy
@param int|null   $limit
@param int|null   $offset

@return QueryBuilder
Build a select query statement by given criteria .