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

Method deletionFilter

lib/Service/DataloadService.php:456–480  ·  view source on GitHub ↗
(int $datasetId, ?string $options)

Source from the content-addressed store, hash-verified

454 }
455
456 private function deletionFilter(int $datasetId, ?string $options): array
457 {
458 $options = json_decode($options ?? '', true);
459 $dimension = $options['filterDimension'] ?? null;
460 $operator = $options['filterOption'] ?? null;
461 $value = $options['filterValue'] ?? null;
462 $dataset = $this->DatasetService->read($datasetId);
463 $dimensions = ['dimension1', 'dimension2'];
464 if (($dataset['storageMode'] ?? '') === 'flexible_shared') {
465 $columns = array_filter($dataset['columns'], static fn ($column) => $column['role'] === 'dimension');
466 $dimensions = array_column($columns, 'ref');
467 }
468 if (!$dataset || !in_array($dimension, $dimensions, true)
469 || !in_array($operator, ['EQ', 'GT', 'LT', 'LIKE', 'NOTLIKE', 'IN', 'NOTIN'], true)
470 || !is_string($value) || trim($value, " '\t\n\r") === ''
471 || (in_array($operator, ['IN', 'NOTIN'], true) && trim($value, " ,;\t\n\r") === '')) {
472 throw new \InvalidArgumentException($this->l10n->t('Select a valid column, operator, and value for the deletion filter.'));
473 }
474
475 $filter = ['filter' => [$dimension => ['option' => $operator, 'value' => $value]]];
476 $metadata = $this->VariableService->replaceFilterVariables([
477 'filteroptions' => json_encode($filter, JSON_THROW_ON_ERROR),
478 ]);
479 return json_decode($metadata['filteroptions'], true, 512, JSON_THROW_ON_ERROR);
480 }
481
482 // Data Manipulation
483 // Data Manipulation

Callers 3

updateMethod · 0.95
executeMethod · 0.95
getDataFromDatasourceMethod · 0.95

Calls 3

readMethod · 0.45
tMethod · 0.45

Tested by

no test coverage detected