diff --git a/src/View.php b/src/View.php index 4dd21dec9f..e879fbfb3e 100644 --- a/src/View.php +++ b/src/View.php @@ -178,11 +178,11 @@ public function setSource(array $data, $fields = null) { // ID with zero value is not supported (at least in MySQL replaces it with next AI value) if (isset($data[0])) { - if ($data === array_values($data)) { + if (array_is_list($data)) { $oldData = $data; $data = []; foreach ($oldData as $k => $row) { - $data[$k + 1000 * 1000 * 1000] = $row; // large offset to prevent accessing wrong data by old key + $data[$k + 1_000_000_000] = $row; // large offset to prevent accessing wrong data by old key } } else { throw new Exception('Source data contains unsupported zero key'); @@ -190,7 +190,6 @@ public function setSource(array $data, $fields = null) } $this->setModel(new Model(new Static_($data)), $fields); // @phpstan-ignore-line - $this->model->getField($this->model->id_field)->type = null; // TODO probably unwanted return $this->model; }