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

Method importThresholds

lib/UserMigration/AnalyticsMigrator.php:308–327  ·  view source on GitHub ↗

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

(string $uid, array $rows, array $reportMap)

Source from the content-addressed store, hash-verified

306 * @throws Exception
307 */
308 private function importThresholds(string $uid, array $rows, array $reportMap): void {
309 foreach ($rows as $row) {
310 $oldReport = isset($row['report']) ? (int)$row['report'] : 0;
311 $newReport = $reportMap[$oldReport] ?? null;
312 if ($newReport === null) {
313 continue;
314 }
315
316 $this->insertAndReturnId('analytics_threshold', [
317 'user_id' => $uid,
318 'report' => $newReport,
319 'dimension' => $this->normalizeNullableInt($row['dimension'] ?? null),
320 'target' => $row['target'] ?? 0,
321 'option' => $row['option'] ?? '',
322 'severity' => isset($row['severity']) ? (int)$row['severity'] : 0,
323 'coloring' => $row['coloring'] ?? 'row',
324 'sequence' => isset($row['sequence']) ? (int)$row['sequence'] : 1,
325 ]);
326 }
327 }
328
329 /**
330 * Keep nullable integer fields nullable during import instead of coercing them to empty strings.

Callers 1

importMethod · 0.95

Calls 2

insertAndReturnIdMethod · 0.95
normalizeNullableIntMethod · 0.95

Tested by

no test coverage detected