Skip to content

Make Importer Interceptable in ImporterFactory #89

Description

@abiverderci

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions