From 6f8e8145ae626ef97ace11479572aa817ac6bda8 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Tue, 15 Oct 2024 16:49:00 +0200 Subject: [PATCH] [TASK] Add data transform warning messages These are especially helpful when using the import by Reaction to give the caller hints about possible errors. --- Classes/Step/TransformDataStep.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Classes/Step/TransformDataStep.php b/Classes/Step/TransformDataStep.php index a955c12..3cd6a08 100644 --- a/Classes/Step/TransformDataStep.php +++ b/Classes/Step/TransformDataStep.php @@ -23,6 +23,7 @@ use Cobweb\ExternalImport\ImporterAwareInterface; use Cobweb\ExternalImport\Utility\MappingUtility; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -238,6 +239,11 @@ public function applyUserFunction(string $name, array $configuration, array $rec } catch (InvalidRecordException $e) { // This exception means that the record must be removed from the dataset entirely unset($records[$index]); + + $this->importer->addMessage( + $e->getMessage(), + ContextualFeedbackSeverity::WARNING + ); $this->importer->debug( sprintf( $this->importer->getLanguageService()->sL('LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:invalidRecordRemoved'), @@ -253,6 +259,11 @@ public function applyUserFunction(string $name, array $configuration, array $rec } catch (\Exception $e) { // If the value could not be transformed, remove it from the imported dataset unset($records[$index][$name]); + + $this->importer->addMessage( + $e->getMessage(), + ContextualFeedbackSeverity::WARNING + ); $this->importer->debug( sprintf( $this->importer->getLanguageService()->sL('LLL:EXT:external_import/Resources/Private/Language/ExternalImport.xlf:transformationFailedWithMessage'),