From c2a3aa3d99097752f7f79525aec1e722feb4aa06 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 18 Sep 2013 16:18:47 -0400 Subject: [PATCH] Fixes #885: removed NULLs from filtering by models. --- framework/yii/db/ActiveRelation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/yii/db/ActiveRelation.php b/framework/yii/db/ActiveRelation.php index 0be4feb..f05c56a 100644 --- a/framework/yii/db/ActiveRelation.php +++ b/framework/yii/db/ActiveRelation.php @@ -279,7 +279,9 @@ class ActiveRelation extends ActiveQuery // single key $attribute = reset($this->link); foreach ($models as $model) { - $values[] = $model[$attribute]; + if (($value = $model[$attribute]) !== null) { + $values[] = $value; + } } } else { // composite keys