Commit 3653db4d by Qiang Xue

Merge pull request #2581 from jom/query-scalar-fix

SELECT DISTINCT queries made subqueries in Query::queryScalar
parents 613e6a0c 0e2b2fcb
...@@ -59,6 +59,7 @@ Yii Framework 2 Change Log ...@@ -59,6 +59,7 @@ Yii Framework 2 Change Log
- Bug: Fixed an issue with Filehelper and not accessable directories which resulted in endless loop (cebe) - Bug: Fixed an issue with Filehelper and not accessable directories which resulted in endless loop (cebe)
- Bug: Fixed `$model->load($data)` returned `true` if `$data` and `formName` were empty (samdark) - Bug: Fixed `$model->load($data)` returned `true` if `$data` and `formName` were empty (samdark)
- Bug: Fixed issue with `ActiveRelationTrait` preventing `ActiveQuery` from clearing events and behaviors on clone (jom) - Bug: Fixed issue with `ActiveRelationTrait` preventing `ActiveQuery` from clearing events and behaviors on clone (jom)
- Bug: `Query::queryScalar` wasn't making `SELECT DISTINCT` queries subqueries (jom)
- Enh #46: Added Image extension based on [Imagine library](http://imagine.readthedocs.org) (tonydspaniard) - Enh #46: Added Image extension based on [Imagine library](http://imagine.readthedocs.org) (tonydspaniard)
- Enh #364: Improve Inflector::slug with `intl` transliteration. Improved transliteration char map. (tonydspaniard) - Enh #364: Improve Inflector::slug with `intl` transliteration. Improved transliteration char map. (tonydspaniard)
- Enh #797: Added support for validating multiple columns by `UniqueValidator` and `ExistValidator` (qiangxue) - Enh #797: Added support for validating multiple columns by `UniqueValidator` and `ExistValidator` (qiangxue)
......
...@@ -356,7 +356,7 @@ class Query extends Component implements QueryInterface ...@@ -356,7 +356,7 @@ class Query extends Component implements QueryInterface
$this->limit = $limit; $this->limit = $limit;
$this->offset = $offset; $this->offset = $offset;
if (empty($this->groupBy)) { if (empty($this->groupBy) && !$this->distinct) {
return $command->queryScalar(); return $command->queryScalar();
} else { } else {
return (new Query)->select([$selectExpression]) return (new Query)->select([$selectExpression])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment