Commit a5506e64 by savvot

yii\redis\ActiveRecord::deleteAll() refactoring - no need to write to socket 2…

yii\redis\ActiveRecord::deleteAll() refactoring - no need to write to socket 2 times when nothing found
parent 4866ce3c
......@@ -233,11 +233,11 @@ class ActiveRecord extends BaseActiveRecord
*/
public static function deleteAll($condition = null)
{
$db = static::getDb();
$attributeKeys = [];
$pks = self::fetchPks($condition);
if(!$pks) return 0;
$db = static::getDb();
$attributeKeys = [];
$db->executeCommand('MULTI');
foreach ($pks as $pk) {
$pk = static::buildKey($pk);
......
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