We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9145988 commit f15fad7Copy full SHA for f15fad7
src/Classes/Bulk.php
@@ -41,6 +41,12 @@ class Bulk
41
*/
42
public $body = [];
43
44
+ /**
45
+ * Number of pending operations
46
+ * @var int
47
+ */
48
+ public $operationCount = 0;
49
+
50
51
/**
52
* Bulk constructor.
@@ -177,6 +183,8 @@ public function action($actionType, $data = [])
177
183
$this->body["body"][] = $data;
178
184
}
179
185
186
+ $this->operationCount++;
187
180
188
$this->reset();
181
189
182
190
@@ -203,5 +211,15 @@ public function reset()
203
211
204
212
205
213
214
215
+ * Commit all pending operations
216
217
+ public function commit()
218
+ {
206
219
220
+ $this->query->connection->bulk($this->body);
221
+ $this->operationCount = 0;
222
+ $this->body = [];
223
224
+ }
207
225
0 commit comments