public function querySelectList(array $contentType, $order = null, $neededFields = [])
    {
        // Only if the first character of the string is `-`, we'll need to sort DESC.'
        if (strpos($order, '-') === 0) {
            $direction = 'DESC';
            $order = ltrim($order, '-');
        } else {
            $direction = 'ASC';
        }

        array_unshift($neededFields, 'id', $this->getTitleColumnName($contentType) . ' as title');

        $qb = $this->createQueryBuilder($contentType['tablename']);
        $qb->select(implode(', ', $neededFields));

        if ($order !== null) {
            $qb->orderBy($order, $direction);
        }

        return $qb;
    }
public function querySelectList(array $contentType, $order = null, $neededFields = [])
    {
        // Only if the first character of the string is `-`, we'll need to sort DESC.'
        if (strpos($order, '-') === 0) {
            $direction = 'DESC';
            $order = ltrim($order, '-');
        } else {
            $direction = 'ASC';
        }

        array_unshift($neededFields, 'id', $this->getTitleColumnName($contentType) . ' as title');

        $qb = $this->createQueryBuilder($contentType['tablename']);
        $qb->select(implode(', ', $neededFields));

        if ($order !== null) {
            $qb->orderBy($order, $direction);
        }

        return $qb;
    }
public function querySelectList ( array $ contentType , $ order = null , $ neededFields = [ ] ) { // Only if the first character of the string is `-`, we'll need to sort DESC.' if ( strpos ( $ order , '-' ) === 0 ) { $ direction = 'DESC' ; $ order = ltrim ( $ order , '-' ) ; } else { $ direction = 'ASC' ; } array_unshift ( $ neededFields , 'id' , $ this -> getTitleColumnName ( $ contentType ) . ' as title' ) ; $ qb = $ this -> createQueryBuilder ( $ contentType [ 'tablename' ] ) ; $ qb -> select ( implode ( ', ' , $ neededFields ) ) ; if ( $ order !== null ) { $ qb -> orderBy ( $ order , $ direction ) ; } return $ qb ; }
Build the query for a record select list.

@param array  $contentType
@param string $order
@param array  $neededFields

@return QueryBuilder
Build the query for a record select list .