class MigrateStub implements MigrateStubInterface (View source)

Provides the migrate stubbing service.

Properties

protected MigrationPluginManagerInterface $migrationPluginManager

The migration plugin manager.

Methods

__construct(MigrationPluginManagerInterface $migration_plugin_manager)

Constructs a MigrationStub object.

array|false
createStub(string $migration_id, array $source_ids, array $default_values = [], bool $key_by_destination_ids = NULL)

Creates a stub.

array|bool
doCreateStub(MigrationInterface $migration, array $source_ids, array $default_values = [])

Creates a stub.

Details

__construct(MigrationPluginManagerInterface $migration_plugin_manager)

Constructs a MigrationStub object.

Parameters

MigrationPluginManagerInterface $migration_plugin_manager

The migration plugin manager.

array|false createStub(string $migration_id, array $source_ids, array $default_values = [], bool $key_by_destination_ids = NULL)

Creates a stub.

Parameters

string $migration_id

The migration to stub.

array $source_ids

An array of source ids.

array $default_values

(optional) An array of default values to add to the stub.

bool $key_by_destination_ids

(optional) NULL or TRUE to force indexing of the return array by destination id keys (default), or FALSE to return the raw return value of the destination plugin's ::import() method. The return value from MigrateDestinationInterface::import() is very poorly defined as "The entity ID or an indication of success". In practice, the mapping systems expect and all destination plugins return an array of destination identifiers. Unfortunately these arrays are inconsistently keyed. The core destination plugins return a numerically indexed array of destination identifiers, but several contrib destinations return an array of identifiers indexed by the destination keys. This method will generally index all return arrays for consistency and to provide as much information as possible, but this parameter is added for backwards compatibility to allow accessing the original array.

Return Value

array|false

An array of destination ids for the new stub, keyed by destination id key, or false if the stub failed.

Exceptions

PluginException
PluginNotFoundException
MigrateException

protected array|bool doCreateStub(MigrationInterface $migration, array $source_ids, array $default_values = [])

Creates a stub.

Parameters

MigrationInterface $migration

The migration to use to create the stub.

array $source_ids

The source ids to map to the stub.

array $default_values

(optional) An array of values to include in the stub.

Return Value

array|bool

An array of destination ids for the stub.

Exceptions

MigrateException