Change record status: 
Project: 
Introduced in branch: 
8.8.x
Introduced in version: 
8.8.0
Description: 

It is useful for migration process plugins to have the ability to do migration lookups, and potentially to have the ability to create stubs. Previously this could only be done manually, or by instantiating a copy of the migration_lookup process plugin outside the context of a migration executable.

In order to facilitate code reuse and simplify this task, two new services are introduced in the migration system.

The migrate.lookup service has one public API method:

public function lookup(string $migration_id, array $source_ids) : array[]

This method takes a migration ID, and an array of source ids. It performs a migration lookup and returns an array of matching results from the migration lookup table. Each result is an array of keyed destination ids, which can be further processed. If a full set of source ids for the migration is provided, the resulting lookup will contain zero or one element. If a partial set of source ids is provided, the result may contain multiple results.
If the lookup fails for any reason other than there simply being no result to find, an error is logged to the system logging service.

The migrate.stub service has one public api as well:

  public function createStub(string $migration_id, array $source_ids, array $default_values = []);

This method takes in a migration id, and an array of source id values, as well as an optional array of default values to use in creating the stub. It generates the stub, and returns a keyed array of the destination id values, or FALSE if the stub fails for any reason. If the stubbing fails, an error is logged to the system logging service.

Impacts: 
Site builders, administrators, editors
Module developers
Distribution developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done