eZ\Publish\Core\Persistence\Database\SelectQuery::select PHP Method

select() public method

select() accepts an arbitrary number of parameters. Each parameter must contain either the name of a column or an array containing the names of the columns. Each call to select() appends columns to the list of columns that will be used in the query. Example: $q->select( 'column1', 'column2' ); The same could also be written $columns[] = 'column1'; $columns[] = 'column2; $q->select( $columns ); or using several calls $q->select( 'column1' )->select( 'column2' ); Each of above code produce SQL clause 'SELECT column1, column2' for the query.
public select ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery
return eZ\Publish\Core\Persistence\Database\SelectQuery returns a pointer to $this.
    public function select();

Usage Example

 /**
  * Apply selects to the query.
  *
  * Returns the name of the (aliased) column, which information should be
  * used for sorting.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
  * @param int $number
  *
  * @return string
  */
 public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
 {
     /** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\MapLocationTarget $target */
     $target = $sortClause->targetData;
     $externalTable = $this->getSortTableName($number, 'ezgmaplocation');
     /*
      * Note: this formula is precise only for short distances.
      */
     $longitudeCorrectionByLatitude = pow(cos(deg2rad($target->latitude)), 2);
     $distanceExpression = $query->expr->add($query->expr->mul($query->expr->sub($this->dbHandler->quoteColumn('latitude', $externalTable), $query->bindValue($target->latitude)), $query->expr->sub($this->dbHandler->quoteColumn('latitude', $externalTable), $query->bindValue($target->latitude))), $query->expr->mul($query->expr->sub($this->dbHandler->quoteColumn('longitude', $externalTable), $query->bindValue($target->longitude)), $query->expr->sub($this->dbHandler->quoteColumn('longitude', $externalTable), $query->bindValue($target->longitude)), $query->bindValue($longitudeCorrectionByLatitude)));
     $query->select($query->alias($distanceExpression, $column1 = $this->getSortColumnName($number)));
     return array($column1);
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Database\SelectQuery::select