Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor Failed categories aren't removed from the categories returned by upsertCategories #17588
Labels
Issue: Format is valid
Gate 1 Passed. Automatic verification of issue format passed
Progress: needs update
The function upsertCategories may return a category id that is no longer present in the DB as upsertCategory on line 138 of Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor fetches the category id from the local class cache ($this->categories) of the available categories.
This causes the import to fail if the category was inserted, added to the cache and then removed from the DB due to either a transaction being rolled back or the category being automatically deleted.
Transactions in this instance are probably being rolled back due to url_key conflicts.
Preconditions
Steps to reproduce
My best guess is that transactions are being rolled back due to url_key conflicts.
Refer to the issue #17586 for clarification on how to set up import data that will have unexpected URL rewrite conflicts.
It would take quite a bit of time to set up a full procedure, but let me know if it's absolutely required.
It should be obvious enough for anyone reviewing the code and referring to the previous bug report #17586
I have implemented a work-around for now, but this needs to be addressed and fixed in the core.
Expected result
The function upsertCategories should only ever return categories that actually exist.
Actual result
The function upsertCategories returns categories from the local class cache that have since been removed from the DB during the same import run.
The text was updated successfully, but these errors were encountered: