Skip to content

Commit dd60d4f

Browse files
committed
Fix issue with voider attempting to batch insert an empty array when no matching statements found
1 parent 4b0e573 commit dd60d4f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/locker/repository/Query/EloquentQueryRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ public function void(array $match, array $opts) {
149149

150150
$opts['authority'] = json_decode(json_encode($opts['client']['authority']));
151151

152-
return (new StatementsRepo())->store(json_decode(json_encode($statements)), [], $opts);
152+
if( count($statements) > 0 ){
153+
return (new StatementsRepo())->store(json_decode(json_encode($statements)), [], $opts);
154+
} else {
155+
return [];
156+
}
153157
}
154158

155159
/**

app/locker/repository/Statement/EloquentInserter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private function checkForConflict(\stdClass $statement, StoreOptions $opts) {
4747
* @param \stdClass $statement_y
4848
* @throws Exceptions\Conflict
4949
*/
50-
private function compareForConflict(\stdClass $statement_x, \stdClass $statement_y) {
50+
public function compareForConflict(\stdClass $statement_x, \stdClass $statement_y) {
5151
$matchable_x = $this->matchableStatement($statement_x);
5252
$matchable_y = $this->matchableStatement($statement_y);
5353
if ($matchable_x != $matchable_y) {

0 commit comments

Comments
 (0)