Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294298

Create Migration Lookup and Stub services

$
0
0

Problem/Motivation

There are a 4-5 process plugins in core which use the following pattern:

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->migration = $migration;
    $this->migrationPlugin = $migration_plugin;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
    $migration_plugin_configuration = $configuration + [
      'migration' => 'd6_filter_format',
    ];

    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $migration,
      $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
    );
  }

These process plugins need to look up a previous migration result, and do so by creating a copy of the (deprecated) migration plugin.

Additionally, the migration_lookup plugin is problematic. It has a number of inconsistencies in its output, uses deprecated methods,

Proposed resolution

Let's turn the result lookup and stub creation into injectable services. The services can be directly injected into the process plugins that require them, and the migration lookup plugin can be a wrapper around these services.

Remaining tasks

Define interfaces
Define services
Refactor migration lookup plugin to use these services
Write tests.
Refactor other plugins that use migration_lookup to use the service instead. (follow ups)

User interface changes

None

API changes

Provide new migration lookup service and interface

Data model changes

None


Viewing all articles
Browse latest Browse all 294298

Trending Articles