Skip to content

Commit d2121f6

Browse files
committed
fix: check on non-empty values only.
1 parent d028977 commit d2121f6

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/Migration/Sources/CSV.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,14 @@ private function exportDocuments(int $batchSize): void
232232
continue;
233233
}
234234

235-
$parsedData[$key] = match ($type) {
236-
Attribute::TYPE_INTEGER => is_numeric($parsedValue) ? (int) $parsedValue : null,
237-
Attribute::TYPE_FLOAT => is_numeric($parsedValue) ? (float) $parsedValue : null,
238-
Attribute::TYPE_BOOLEAN => filter_var($parsedValue, FILTER_VALIDATE_BOOLEAN),
239-
default => $parsedValue,
240-
};
235+
if ($parsedValue !== '') {
236+
$parsedData[$key] = match ($type) {
237+
Attribute::TYPE_INTEGER => is_numeric($parsedValue) ? (int)$parsedValue : null,
238+
Attribute::TYPE_FLOAT => is_numeric($parsedValue) ? (float)$parsedValue : null,
239+
Attribute::TYPE_BOOLEAN => filter_var($parsedValue, FILTER_VALIDATE_BOOLEAN),
240+
default => $parsedValue,
241+
};
242+
}
241243
}
242244

243245
$documentId = $parsedData['$id'] ?? 'unique()';

0 commit comments

Comments
 (0)