* Delete Dataset and all depending objects * * @param int $reportId * @return string * @throws Exception */
(int $reportId)
| 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 |
no test coverage detected