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

Method importDataloads

lib/UserMigration/AnalyticsMigrator.php:274–292  ·  view source on GitHub ↗

* @param list > $rows * @param array $datasetMap * @throws Exception */

(string $uid, array $rows, array $datasetMap, array $columnMaps = [])

Source from the content-addressed store, hash-verified

272 * @throws Exception
273 */
274 private function importDataloads(string $uid, array $rows, array $datasetMap, array $columnMaps = []): void {
275 foreach ($rows as $row) {
276 $oldDataset = isset($row['dataset']) ? (int)$row['dataset'] : 0;
277 $newDataset = $datasetMap[$oldDataset] ?? null;
278 if ($newDataset === null) {
279 continue;
280 }
281
282 $this->insertAndReturnId('analytics_dataload', [
283 'user_id' => $uid,
284 'name' => $row['name'] ?? '',
285 'dataset' => $newDataset,
286 'datasource' => isset($row['datasource']) ? (int)$row['datasource'] : 0,
287 'option' => $row['option'] ?? '{}',
288 'schedule' => $row['schedule'] ?? null,
289 'storage_mapping' => $this->remapReferenceJson($row['storage_mapping'] ?? null, $columnMaps[$oldDataset] ?? []),
290 ]);
291 }
292 }
293
294 /**
295 * @param array<string,mixed> $payload

Callers 1

importMethod · 0.95

Calls 2

insertAndReturnIdMethod · 0.95
remapReferenceJsonMethod · 0.95

Tested by

no test coverage detected