Skip to content

Commit

Permalink
Catch Type error for assignData on import - resolves #367
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Nov 1, 2023
1 parent d2dc42e commit daa6f0f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Processing/ImportProcessingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ protected function processElement(string $configName, array $importDataRow, Reso
$element = $resolver->loadOrCreateAndPrepareElement($importDataRow, $createNew);

if ($element instanceof ElementInterface) {
$this->applicationLogger->info("⭢ Processing DataRow {$importDataRowString}", [
'component' => PimcoreDataImporterBundle::LOGGER_COMPONENT_PREFIX . $configName,
null,
'relatedObject' => $element
]);

foreach ($mapping as $mappingConfiguration) {

// extract raw data
Expand All @@ -217,11 +223,6 @@ protected function processElement(string $configName, array $importDataRow, Reso
$dataTarget = $mappingConfiguration->getDataTarget();
$dataTarget->assignData($element, $data);
}
$this->applicationLogger->info("⭢ Processing DataRow {$importDataRowString}", [
'component' => PimcoreDataImporterBundle::LOGGER_COMPONENT_PREFIX . $configName,
null,
'relatedObject' => $element
]);

$event = new PreSaveEvent($configName, $importDataRow, $element);
$this->eventDispatcher->dispatch($event);
Expand All @@ -247,7 +248,7 @@ protected function processElement(string $configName, array $importDataRow, Reso
'fileObject' => new FileObject(json_encode($importDataRow))
]);
}
} catch (\Exception $e) {
} catch (\Exception | \TypeError $e) {
$message = "Error processing element: {$importDataRowString}";
$this->logger->error($message . $e);

Expand Down

0 comments on commit daa6f0f

Please sign in to comment.