fclose($fileHandle);
if (empty($record) ||
$record[0
] === null
) { throw new InvalidFileContentException($file->
getFilename());
} // construct the mapping from the given CSV line data
$definition =
$this->definitionInstanceRegistry->
getByEntityName($sourceEntity);
$keyLookupTable =
$this->
getKeyLookupTable($context,
$sourceEntity);
$mappings =
new MappingCollection();
foreach ($record as $index =>
$column) { $mappings->
add(new Mapping( $this->
guessKeyFromMappedKey($keyLookupTable,
$column,
$definition),
$column,
$index ));
} return $mappings;
} /**
* Gather all mapping keys used in all profiles with the same source entity and fill the keyLookupTable.
* Keys from newer profiles are prioritized.
*/