Skip to content

Commit 1a191b5

Browse files
committed
fix: TypeError when Time is passed to Model
1 parent f846ffd commit 1a191b5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

system/BaseModel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,9 @@ public function insertBatch(?array $set = null, ?bool $escape = null, int $batch
926926
$row = (array) $row;
927927
}
928928

929+
// Convert any Time instances to appropriate $dateFormat
930+
$row = $this->timeToString($row);
931+
929932
// Validate every row.
930933
if (! $this->skipValidation && ! $this->validate($row)) {
931934
// Restore $cleanValidationRules
@@ -1845,8 +1848,6 @@ protected function transformDataToArray($row, string $type): array
18451848
$row = $this->converter->toDataSource($row);
18461849
} elseif ($row instanceof Entity) {
18471850
$row = $this->converter->extract($row, $onlyChanged);
1848-
// Convert any Time instances to appropriate $dateFormat
1849-
$row = $this->timeToString($row);
18501851
} elseif (is_object($row)) {
18511852
$row = $this->converter->extract($row, $onlyChanged);
18521853
}
@@ -1870,7 +1871,8 @@ protected function transformDataToArray($row, string $type): array
18701871
throw DataException::forEmptyDataset($type);
18711872
}
18721873

1873-
return $row;
1874+
// Convert any Time instances to appropriate $dateFormat
1875+
return $this->timeToString($row);
18741876
}
18751877

18761878
/**

0 commit comments

Comments
 (0)