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

Method positionalImportMapping

lib/Service/DataloadService.php:756–775  ·  view source on GitHub ↗

@param list > $columns * @param list $header * @param list > $rows * @return array */

(array $columns, array $header, array $rows)

Source from the content-addressed store, hash-verified

754 * @return array<string,mixed>
755 */
756 private function positionalImportMapping(array $columns, array $header, array $rows): array
757 {
758 $count = count($columns);
759 if (count($header) !== $count) {
760 throw new FlexibleStorageException('invalid_source_columns', 'The import must have one field for each dataset column, in the same order.');
761 }
762 foreach ($rows as $index => $row) {
763 if (!is_array($row) || count($row) !== $count) {
764 throw new FlexibleStorageException('invalid_source_row', 'Each imported row must have one field for each dataset column.', ['record' => $index]);
765 }
766 }
767 return [
768 'schemaVersion' => 1,
769 'sourceHeader' => $header,
770 'columns' => array_map(static fn (array $column, int $index): array => [
771 'column' => $column['ref'],
772 'sourceIndex' => $index,
773 ], $columns, array_keys($columns)),
774 ];
775 }
776
777 private function getDataloadMetadata(int $dataloadId, bool $enforceOwnership)
778 {

Callers 2

importClipboardMethod · 0.95
importFileMethod · 0.95

Calls 1

countFunction · 0.50

Tested by

no test coverage detected