* Delete Dataset and all depending objects * * @param int $reportId * @return string * @throws Exception */
(int $reportId)
| 360 | * @throws Exception |
| 361 | */ |
| 362 | public function delete(int $reportId) { |
| 363 | $metadata = $this->ReportMapper->readOwn($reportId); |
| 364 | $this->ActivityManager->triggerEvent($reportId, ActivityManager::OBJECT_REPORT, ActivityManager::SUBJECT_REPORT_DELETE); |
| 365 | $this->ShareService->deleteSharesByItem(ShareService::SHARE_ITEM_TYPE_REPORT, $reportId); |
| 366 | $this->ThresholdMapper->deleteThresholdByReport($reportId); |
| 367 | $this->setFavorite($reportId, 'false'); |
| 368 | $this->ReportMapper->delete($reportId); |
| 369 | |
| 370 | $report = $this->reportsForDataset((int)$metadata['dataset']); |
| 371 | if (empty($report) && (int)$metadata['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) { |
| 372 | return $metadata['dataset']; |
| 373 | } else { |
| 374 | return 'true'; |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * get dataset by user |
no test coverage detected