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

Method read

lib/Controller/OutputController.php:88–115  ·  view source on GitHub ↗

* get the data when requested from internal page * If-None-Match and eTags are being handled * * @param int $reportId * @param $filteroptions * @param $dataoptions * @param $chartoptions * @param $tableoptions * @return DataResponse|NotFoundResponse * @throws Exception */

(int $reportId, $filteroptions, $dataoptions, $chartoptions, $tableoptions, ?string $chart = null, ?string $visualization = null)

Source from the content-addressed store, hash-verified

86 * @throws Exception
87 */
88 #[NoAdminRequired]
89 public function read(int $reportId, $filteroptions, $dataoptions, $chartoptions, $tableoptions, ?string $chart = null, ?string $visualization = null) {
90 $reportMetadata = $this->ReportService->read($reportId);
91 if (empty($reportMetadata)) $reportMetadata = $this->ShareService->getSharedReport($reportId);
92
93 if (!empty($reportMetadata)) {
94 $reportMetadata = $this->evaluateCanFilter($reportMetadata, $filteroptions, $dataoptions, $chartoptions, $tableoptions, $chart, $visualization);
95 if ($filteroptions === null) {
96 $reportMetadata['cacheKey'] = $this->getDatasourceCacheKey(
97 $reportMetadata,
98 $this->getRequestCacheKey()
99 );
100 }
101
102 // internal storage reports are validated directly against version
103 if ((int)$reportMetadata['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) {
104 $response = $this->evaluateIfNoneMatch($reportMetadata);
105 if ($response instanceof DataResponse && $filteroptions === null) {
106 return $response;
107 }
108 }
109
110 // external datasource caching is evaluated by datasource specific logic
111 return $this->returnDataWithCacheableHeader($reportMetadata, $filteroptions);
112 } else {
113 return new NotFoundResponse();
114 }
115 }
116
117 /**
118 * get the data when requested from a panorama

Callers 2

readPanoramaMethod · 0.45
getDataMethod · 0.45

Calls 6

evaluateCanFilterMethod · 0.95
getDatasourceCacheKeyMethod · 0.95
getRequestCacheKeyMethod · 0.95
evaluateIfNoneMatchMethod · 0.95
getSharedReportMethod · 0.80

Tested by

no test coverage detected