Skip to content

Commit 6b05c90

Browse files
committed
fix: updateBatch() may generate invalid SQL string
1 parent 2238bf1 commit 6b05c90

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

system/BaseModel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,9 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
979979
// properties representing the collection elements, we need to grab
980980
// them as an array.
981981
if (is_object($row) && ! $row instanceof stdClass) {
982-
$row = $this->objectToArray($row, true, true);
982+
// For updates the index field is needed even if it is not changed.
983+
// So set $onlyChanged to false.
984+
$row = $this->objectToArray($row, false, true);
983985
}
984986

985987
// If it's still a stdClass, go ahead and convert to

0 commit comments

Comments
 (0)