Skip to content

Commit 9ccd617

Browse files
committed
Some exceptions
1 parent 9d3c623 commit 9ccd617

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/Database/Database.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5812,7 +5812,16 @@ public function deleteDocuments(
58125812
$internalIds = [];
58135813
$permissionIds = [];
58145814
foreach ($batch as $document) {
5815+
if (empty($document->getInternalId())){
5816+
throw new QueryException('$internalId must not be empty');
5817+
}
5818+
58155819
$internalIds[] = $document->getInternalId();
5820+
5821+
if (!array_key_exists('$permissions', $document)) {
5822+
throw new QueryException('$permissions key is missing');
5823+
}
5824+
58165825
if (!empty($document->getPermissions())) {
58175826
$permissionIds[] = $document->getId();
58185827
}
@@ -5825,6 +5834,10 @@ public function deleteDocuments(
58255834
}
58265835

58275836
// Check if document was updated after the request timestamp
5837+
if (empty($document->getUpdatedAt())){
5838+
throw new QueryException('$updatedAt must not be empty');
5839+
}
5840+
58285841
try {
58295842
$oldUpdatedAt = new \DateTime($document->getUpdatedAt());
58305843
} catch (Exception $e) {

0 commit comments

Comments
 (0)