Skip to content

Commit 1170ca2

Browse files
committed
修正当模型定义了const UPDATED_AT = null;时批量插入导致的额外添加了更新时间导致的异常错误
1 parent ed62d0f commit 1170ca2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Batch.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ public function insert(Model $table, array $columns, array $values, int $batchSi
295295
$addCreatedAtValue = false;
296296
$addUpdatedAtValue = false;
297297

298-
if (!in_array($createdAtColumn, $columns)) {
298+
if ($createdAtColumn && !in_array($createdAtColumn, $columns)) {
299299
$addCreatedAtValue = true;
300300
array_push($columns, $createdAtColumn);
301301
}
302302

303-
if (!in_array($updatedAtColumn, $columns)) {
303+
if ($updatedAtColumn && !in_array($updatedAtColumn, $columns)) {
304304
$addUpdatedAtValue = true;
305305
array_push($columns, $updatedAtColumn);
306306
}

0 commit comments

Comments
 (0)