Skip to content

Commit

Permalink
fix: updateBatch() may generate invalid SQL string
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Aug 7, 2023
1 parent 2238bf1 commit 6b05c90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,9 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
// properties representing the collection elements, we need to grab
// them as an array.
if (is_object($row) && ! $row instanceof stdClass) {
$row = $this->objectToArray($row, true, true);
// For updates the index field is needed even if it is not changed.
// So set $onlyChanged to false.
$row = $this->objectToArray($row, false, true);
}

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

0 comments on commit 6b05c90

Please sign in to comment.