Commit df22ffa3 by Carsten Brandt

redis AR cleanup

parent f3aa807d
...@@ -60,10 +60,10 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -60,10 +60,10 @@ class ActiveRecord extends \yii\db\ActiveRecord
*/ */
public static function updateAll($attributes, $condition = null, $params = array()) public static function updateAll($attributes, $condition = null, $params = array())
{ {
$db = static::getDb();
if (empty($attributes)) { if (empty($attributes)) {
return 0; return 0;
} }
$db = static::getDb();
$n=0; $n=0;
foreach(static::fetchPks($condition) as $pk) { foreach(static::fetchPks($condition) as $pk) {
$newPk = $pk; $newPk = $pk;
...@@ -113,6 +113,9 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -113,6 +113,9 @@ class ActiveRecord extends \yii\db\ActiveRecord
*/ */
public static function updateAllCounters($counters, $condition = null, $params = array()) public static function updateAllCounters($counters, $condition = null, $params = array())
{ {
if (empty($counters)) {
return 0;
}
$db = static::getDb(); $db = static::getDb();
$n=0; $n=0;
foreach(static::fetchPks($condition) as $pk) { foreach(static::fetchPks($condition) as $pk) {
...@@ -177,7 +180,6 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -177,7 +180,6 @@ class ActiveRecord extends \yii\db\ActiveRecord
return $pks; return $pks;
} }
/** /**
* Builds a normalized key from a given primary key value. * Builds a normalized key from a given primary key value.
* *
......
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