diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index a75699da..05894ee5 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -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); } diff --git a/Database/Command.php b/Database/Command.php index b3ac6818..b72eb5a3 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -306,12 +306,14 @@ class Command extends Component } /** + * @param null $scope + * @param bool $insert * @return int|bool|array|string|null * @throws Exception */ - public function exec(): int|bool|array|string|null + public function exec($scope = null, $insert = false): int|bool|array|string|null { - return $this->execute(static::EXECUTE); + return $this->execute(static::EXECUTE, $insert, $scope); } /**