|
|
@ -41,8 +41,8 @@ class Query extends Component implements QueryInterface |
|
|
|
use QueryTrait; |
|
|
|
use QueryTrait; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var array the fields of the results to return. For example, `['name', 'group_id']`. |
|
|
|
* @var array the fields of the results to return. For example: `['name', 'group_id']`, `['name' => true, '_id' => false]`. |
|
|
|
* The "_id" field is always returned. If not set, if means selecting all columns. |
|
|
|
* Unless directly excluded, the "_id" field is always returned. If not set, it means selecting all columns. |
|
|
|
* @see select() |
|
|
|
* @see select() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public $select = []; |
|
|
|
public $select = []; |
|
|
@ -377,8 +377,12 @@ class Query extends Component implements QueryInterface |
|
|
|
{ |
|
|
|
{ |
|
|
|
$selectFields = []; |
|
|
|
$selectFields = []; |
|
|
|
if (!empty($this->select)) { |
|
|
|
if (!empty($this->select)) { |
|
|
|
foreach ($this->select as $fieldName) { |
|
|
|
foreach ($this->select as $key => $value) { |
|
|
|
$selectFields[$fieldName] = true; |
|
|
|
if (is_numeric($key)) { |
|
|
|
|
|
|
|
$selectFields[$value] = true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$selectFields[$key] = $value; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $selectFields; |
|
|
|
return $selectFields; |
|
|
|