From df22ffa304503c3f7f86cf5996e9088e8b1d01a7 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 25 Sep 2013 11:54:43 +0200 Subject: [PATCH] redis AR cleanup --- framework/yii/redis/ActiveRecord.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/yii/redis/ActiveRecord.php b/framework/yii/redis/ActiveRecord.php index 3929788c4b..fb26818ff8 100644 --- a/framework/yii/redis/ActiveRecord.php +++ b/framework/yii/redis/ActiveRecord.php @@ -60,10 +60,10 @@ class ActiveRecord extends \yii\db\ActiveRecord */ public static function updateAll($attributes, $condition = null, $params = array()) { - $db = static::getDb(); if (empty($attributes)) { return 0; } + $db = static::getDb(); $n=0; foreach(static::fetchPks($condition) as $pk) { $newPk = $pk; @@ -113,6 +113,9 @@ class ActiveRecord extends \yii\db\ActiveRecord */ public static function updateAllCounters($counters, $condition = null, $params = array()) { + if (empty($counters)) { + return 0; + } $db = static::getDb(); $n=0; foreach(static::fetchPks($condition) as $pk) { @@ -177,7 +180,6 @@ class ActiveRecord extends \yii\db\ActiveRecord return $pks; } - /** * Builds a normalized key from a given primary key value. *