From a3e128bb0b8c12a05fbb9caa5bac4e9c015e61b2 Mon Sep 17 00:00:00 2001 From: Jacob Morrison <jmorrison@psesd.org> Date: Thu, 27 Feb 2014 16:04:16 -0800 Subject: [PATCH] Query::queryScalar wasn't making SELECT DISTINCT queries subqueries --- framework/CHANGELOG.md | 1 + framework/db/Query.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 796f0cb..3f2a173 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -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 `$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: `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 #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) diff --git a/framework/db/Query.php b/framework/db/Query.php index 15d43d5..488b6e1 100644 --- a/framework/db/Query.php +++ b/framework/db/Query.php @@ -356,7 +356,7 @@ class Query extends Component implements QueryInterface $this->limit = $limit; $this->offset = $offset; - if (empty($this->groupBy)) { + if (empty($this->groupBy) && $this->distinct !== true) { return $command->queryScalar(); } else { return (new Query)->select([$selectExpression]) -- libgit2 0.27.1