We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7cbfc6a commit fa03ae6Copy full SHA for fa03ae6
1 file changed
src/Package/System/events/collection.php
@@ -116,17 +116,13 @@
116
return;
117
}
118
119
- //get the last id
120
- $lastId = $response->getResults();
+ //NOTE: in a mass insert, the last id is actually the first id
+ $firstId = $response->getResults();
121
122
foreach ($data['rows'] as $i => $row) {
123
//re insert the id into the rows
124
- //ex. 10 is the last id and there are 3 rows
125
- // 1st = 10 - (3 - (0 + 1)) = 8
126
- // 2nd = 10 - (3 - (1 + 1)) = 9
127
- // 3rd = 10 - (3 - (2 + 1)) = 10
128
if (!isset($data['rows'][$i][$primary])) {
129
- $data['rows'][$i][$primary] = $lastId - (count($data['rows']) - ($i + 1));
+ $data['rows'][$i][$primary] = $firstId + $i;
130
131
132
$row[$primary] = $data['rows'][$i][$primary];
0 commit comments