Skip to content

Commit b4a33e8

Browse files
committed
Flip + isset
1 parent ba3fe87 commit b4a33e8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Migration/Sources/CSV.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ private function exportDocuments(int $batchSize): void
180180
}
181181
}
182182

183+
$manyToManyKeys = \array_flip($manyToManyKeys);
184+
$arrayKeys = \array_flip($arrayKeys);
185+
183186
$this->withCSVStream(function ($stream) use ($attributeTypes, $manyToManyKeys, $arrayKeys, $collection, $batchSize) {
184187
$headers = fgetcsv($stream);
185188
if (! is_array($headers) || count($headers) === 0) {
@@ -210,7 +213,7 @@ private function exportDocuments(int $batchSize): void
210213
continue;
211214
}
212215

213-
if (in_array($key, $manyToManyKeys, true)) {
216+
if (isset($manyToManyKeys[$key])) {
214217
$parsedData[$key] = $parsedValue === ''
215218
? []
216219
: array_values(
@@ -224,7 +227,7 @@ private function exportDocuments(int $batchSize): void
224227
continue;
225228
}
226229

227-
if (in_array($key, $arrayKeys, true)) {
230+
if (isset($arrayKeys[$key])) {
228231
if ($parsedValue === '') {
229232
$parsedData[$key] = [];
230233
} else {

0 commit comments

Comments
 (0)