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

Method delete

lib/Service/ReportService.php:371–385  ·  view source on GitHub ↗

* Delete Dataset and all depending objects * * @param int $reportId * @return string * @throws Exception */

(int $reportId)

Source from the content-addressed store, hash-verified

369 * @throws Exception
370 */
371 public function delete(int $reportId) {
372 $metadata = $this->ReportMapper->readOwn($reportId);
373 $this->ActivityManager->triggerEvent($reportId, ActivityManager::OBJECT_REPORT, ActivityManager::SUBJECT_REPORT_DELETE);
374 $this->ShareService->deleteSharesByItem(ShareService::SHARE_ITEM_TYPE_REPORT, $reportId);
375 $this->ThresholdMapper->deleteThresholdByReport($reportId);
376 $this->setFavorite($reportId, 'false');
377 $this->ReportMapper->delete($reportId);
378
379 $report = $this->reportsForDataset((int)$metadata['dataset']);
380 if (empty($report) && (int)$metadata['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) {
381 return $metadata['dataset'];
382 } else {
383 return 'true';
384 }
385 }
386
387 /**
388 * get dataset by user

Callers 1

deleteByUserMethod · 0.45

Calls 6

setFavoriteMethod · 0.95
reportsForDatasetMethod · 0.95
triggerEventMethod · 0.80
readOwnMethod · 0.45
deleteSharesByItemMethod · 0.45

Tested by

no test coverage detected