Jh\Import\Import\ImporterFactory::create() returns new Importer(...) directly. Because the object is not created through the object manager, Magento never substitutes an Importer\Interceptor, so any plugin declared against Jh\Import\Import\Importer is silently inert.
Additional note: the $indexer argument also news its value and the $progress argument is also resolved at runtime via a progressFactory->get() - not carrying this over (ie, letting di handle the injection here) may cause regressions
Suggested Fix
Create Importer through the object manager inside ImporterFactory::create() rather than with new, ensuring runtime arguments remain consistent
Risks
- Any consuming project that declared a plugin on
Importer and never realised it was inert would have that plugin start firing on upgrade, with no code change on their side.
Acceptance Criteria
- A plugin declared against
Jh\Import\Import\Importer::process() fires for a real import run.
setup:di:compile generates an Importer interceptor.
- Indexer and the progress implementation are still supplied by
ImporterFactory, not by DI, and are covered by a test that fails if either is dropped.
- Existing import behaviour is unchanged when no plugin is declared.
Jh\Import\Import\ImporterFactory::create()returns newImporter(...)directly. Because the object is not created through the object manager, Magento never substitutes anImporter\Interceptor, so any plugin declared againstJh\Import\Import\Importeris silently inert.Additional note: the
$indexerargument alsonews its value and the$progressargument is also resolved at runtime via aprogressFactory->get()- not carrying this over (ie, letting di handle the injection here) may cause regressionsSuggested Fix
Create
Importerthrough the object manager insideImporterFactory::create()rather than withnew, ensuring runtime arguments remain consistentRisks
Importerand never realised it was inert would have that plugin start firing on upgrade, with no code change on their side.Acceptance Criteria
Jh\Import\Import\Importer::process()fires for a real import run.setup:di:compilegenerates an Importer interceptor.ImporterFactory, not by DI, and are covered by a test that fails if either is dropped.