diff --git a/ActiveQuery.php b/ActiveQuery.php index 6380834..5e43d1f 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -286,6 +286,9 @@ class ActiveQuery extends Component implements ISqlBuilder */ public function update(array $data): bool { + if (count($data) < 1) { + return true; + } $generate = $this->builder->update($data); if (is_bool($generate)) { return $generate; diff --git a/Base/Model.php b/Base/Model.php index b0a6594..f5cc2f9 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -456,6 +456,9 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T protected function updateInternal(array $old, array $condition, array $change): bool|static { $query = static::query()->where($condition); + if (count($change)) { + return true; + } $generate = SqlBuilder::builder($query)->update($change); if ($generate === false) { return false; @@ -579,6 +582,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T /** * @return Relation|null + * @throws ReflectionException */ public function getRelation(): ?Relation {