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

Method export

lib/Service/DatasetService.php:275–293  ·  view source on GitHub ↗

* Export Dataset * * @param int $datasetId * @return DataDownloadResponse * @throws Exception */

(int $datasetId)

Source from the content-addressed store, hash-verified

273 * @throws Exception
274 */
275 public function export(int $datasetId) {
276 $result = array();
277 $result['dataset'] = $this->DatasetMapper->read($datasetId);
278 $result['dataload'] = $this->DataloadMapper->read($datasetId);
279 $result['threshold'] = $this->ThresholdService->read($datasetId);
280 $result['favorite'] = '';
281
282 if ($result['dataset']['type'] === DatasourceController::DATASET_TYPE_INTERNAL_DB) {
283 if (($result['dataset']['storage_mode'] ?? 'legacy') === 'flexible_shared') {
284 $result['flexible'] = $this->FlexibleStorageService->exportDataset($datasetId);
285 } else {
286 $result['data'] = $this->StorageMapper->read($datasetId);
287 }
288 }
289
290 unset($result['dataset']['id'], $result['dataset']['user_id'], $result['dataset']['user_id'], $result['dataset']['parent']);
291 $data = json_encode($result);
292 return new DataDownloadResponse($data, $result['dataset']['name'] . '.export.txt', 'text/plain; charset=utf-8');
293 }
294
295 /**
296 * Update the context chat provider

Callers

nothing calls this directly

Calls 2

exportDatasetMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected