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);
}
+4 -2
View File
@@ -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);
}
/**