try { if (isset($record['_error'
]) &&
$record['_error'
] instanceof \Throwable
) { throw $record['_error'
];
} // ensure that the raw csv row has all the fields, which are marked as required by the user.
$this->
ensureUserRequiredFields($row,
$config);
$record =
$this->
ensurePrimaryKeys($record);
$event =
new ImportExportBeforeImportRecordEvent($record,
$row,
$config,
$context);
$this->eventDispatcher->
dispatch($event);
$record =
$event->
getRecord();
if ($createEntities === true &&
$updateEntities === false
) { $result =
$this->repository->
create([$record],
$context);
} elseif ($createEntities === false &&
$updateEntities === true
) { $result =
$this->repository->
update([$record],
$context);
} else { // expect that both create and update are true -> upsert
// both false isn't possible via admin (but still results in an upsert)