(int $datasetId, int $recordId)
| 184 | } |
| 185 | |
| 186 | public function deleteRecord(int $datasetId, int $recordId): array { |
| 187 | $this->requireFlexible($datasetId, true); |
| 188 | if (!$this->storageMapper->recordBelongsToDataset($datasetId, $recordId)) { |
| 189 | throw new FlexibleStorageException('record_not_found', 'The record does not exist or is not accessible.', ['recordId' => $recordId], 404); |
| 190 | } |
| 191 | $this->storageMapper->beginTransaction(); |
| 192 | try { |
| 193 | $this->storageMapper->deleteRecord($datasetId, $recordId); |
| 194 | $this->storageMapper->commit(); |
| 195 | } catch (\Throwable $e) { |
| 196 | $this->storageMapper->rollBack(); |
| 197 | throw new FlexibleStorageException('record_delete_failed', 'The record could not be deleted.', ['recordId' => $recordId], 500, $e); |
| 198 | } |
| 199 | $this->reportMapper->increaseVersionByDataset($datasetId); |
| 200 | return ['recordId' => $recordId, 'deleted' => 1]; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * @param array<string,mixed> $query |
no test coverage detected