MCPcopy Create free account
hub / github.com/Rello/analytics / deleteRecord

Method deleteRecord

lib/Service/FlexibleStorageService.php:186–201  ·  view source on GitHub ↗
(int $datasetId, int $recordId)

Source from the content-addressed store, hash-verified

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

Callers 1

deleteWithFilterMethod · 0.45

Calls 6

requireFlexibleMethod · 0.95
beginTransactionMethod · 0.45
commitMethod · 0.45
rollBackMethod · 0.45

Tested by

no test coverage detected