This commit is contained in:
2021-02-23 18:36:40 +08:00
parent 84565336ed
commit 7187434d6f
2 changed files with 5 additions and 32 deletions
+1 -30
View File
@@ -149,36 +149,7 @@ class ActiveRecord extends BaseActiveRecord
}
return static::getDb()->createCommand()
->mathematics(self::getTable(), [$action => $columns], $condition)
->exec();
}
/**
* @param $column
* @param $value
* @param array $condition
* @return bool
* @throws Exception
*/
public static function incrAll($column, $value, $condition = []): bool
{
return static::getDb()->createCommand()
->mathematics(self::getTable(), [self::INCR => [$column, $value]], $condition)
->exec();
}
/**
* @param $column
* @param $value
* @param array $condition
* @return bool
* @throws Exception
*/
public static function decrAll($column, $value, $condition = []): bool
{
return static::getDb()->createCommand()
->mathematics(self::getTable(), [self::DECR => [$column, $value]], $condition)
->exec();
->exec(false, $this);
}