* Delete Dataset and all depending objects * * @param int $reportId * @return string * @throws Exception */
(int $reportId)
| 336 | * @throws Exception |
| 337 | */ |
| 338 | public function delete(int $reportId) { |
| 339 | $metadata = $this->ReportMapper->readOwn($reportId); |
| 340 | $this->ActivityManager->triggerEvent($reportId, ActivityManager::OBJECT_REPORT, ActivityManager::SUBJECT_REPORT_DELETE); |
| 341 | $this->ShareService->deleteSharesByItem(ShareService::SHARE_ITEM_TYPE_REPORT, $reportId); |
| 342 | $this->ThresholdMapper->deleteThresholdByReport($reportId); |
| 343 | $this->setFavorite($reportId, 'false'); |
| 344 | $this->ReportMapper->delete($reportId); |
| 345 | |
| 346 | $report = $this->reportsForDataset((int)$metadata['dataset']); |
| 347 | if (empty($report) && (int)$metadata['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) { |
| 348 | return $metadata['dataset']; |
| 349 | } else { |
| 350 | return 'true'; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * get dataset by user |
no test coverage detected