改名
This commit is contained in:
@@ -266,7 +266,11 @@ class ActiveQuery extends Component implements ISqlBuilder
|
|||||||
*/
|
*/
|
||||||
public function batchUpdate(array $data): Command|array|bool|int|string
|
public function batchUpdate(array $data): Command|array|bool|int|string
|
||||||
{
|
{
|
||||||
return $this->execute($this->builder->update($data))->exec();
|
$generate = $this->builder->update($data);
|
||||||
|
if (is_bool($generate)) {
|
||||||
|
return $generate;
|
||||||
|
}
|
||||||
|
return $this->execute(...$generate)->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -468,10 +468,13 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
$condition = [$this->getPrimary() => $this->getPrimaryValue()];
|
$condition = [$this->getPrimary() => $this->getPrimaryValue()];
|
||||||
}
|
}
|
||||||
|
|
||||||
[$sql, $param] = SqlBuilder::builder(static::find()->where($condition))->update($param);
|
$generate = SqlBuilder::builder(static::find()->where($condition))->update($param);
|
||||||
|
if (is_bool($generate)) {
|
||||||
|
return $generate;
|
||||||
|
}
|
||||||
|
|
||||||
$trance = $command->beginTransaction();
|
$trance = $command->beginTransaction();
|
||||||
if (!$command->createCommand($sql, $param)->save(false, $this)) {
|
if (!$command->createCommand(...$generate)->save(false, $this)) {
|
||||||
$trance->rollback();
|
$trance->rollback();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user