cobwebch / external_import

Other
20 stars 16 forks source link

An exception occurred while saving the data: PHP Warning: Undefined array key "region" #347

Open Pekkonen opened 1 month ago

Pekkonen commented 1 month ago

Hi! I have a bug with external_import, but I'm not sure in 100% in that. I have TYPO3 12.4.21, bobosch/ods-osm - 4.2.2 and cobweb/external_importb - 7.2.5. Then I trying to import CSV file to tt_address table I have an exception about ods_osm:

An exception occurred while saving the data: PHP Warning: Undefined array key "region" in /var/www/html/site/vendor/bobosch/ods-osm/Classes/TceMain.php line 318 (code: 1476107295, location: /var/www/html/site/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php at line 141)

In MySQL tt_address I have a correct structure with region table. TYPO3 database analyse I have - "Database schema is up to date. Good job!"

When I uninstall ods_osm everything is going right without any errors. In import process I have just mapping data from CSV columns to the tt_address columns, but no handling "region" column

Pekkonen commented 1 month ago

When I'm trying to use custom transformation for latitude and longitude (not simple get/put values from CSV, but transform it in my viewhelper) I have a same error but about longitude: An exception occurred while saving the data: PHP Warning: Undefined array key "longitude" in /var/www/html/site/vendor/bobosch/ods-osm/Classes/TceMain.php line 318 (code: 1476107295, location: /var/www/html/site/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php at line 141)

fsuter commented 1 month ago

Hi. The error clearly points to class TceMain in extension "ods-osm", and I can't see how External Import could be involved. What I understand from what you write is that you don't import any region and thus the region field is null. However "ods-osm" apparently expects the region to be always not null. So I would say the proper way to solve this is to fix "ods-osm". If that is not possible, you can use External Import to import a dummy value in the region field, using a simple value-setting property: https://docs.typo3.org/p/cobweb/external_import/7.2/en-us/Administration/Columns/Index.html#administration-columns-properties-value