1. 8.5.x core/modules/migrate/migrate.api.php migration
  2. 8.0.x core/modules/migrate/migrate.api.php migration
  3. 8.1.x core/modules/migrate/migrate.api.php migration
  4. 8.2.x core/modules/migrate/migrate.api.php migration
  5. 8.3.x core/modules/migrate/migrate.api.php migration
  6. 8.4.x core/modules/migrate/migrate.api.php migration
  7. 8.6.x core/modules/migrate/migrate.api.php migration

Overview of the Migration API, which migrates data into Drupal.

Overview of migration

Migration is an Extract, Transform, Load (ETL) process. In the Drupal migration API the extract phase is called "source", the transform phase is called "process", and the load phase is called "destination". It is important to understand that the "load" in ETL means to load data into storage, while traditionally Drupal uses "load" to mean load data from storage into memory.

Source, process, and destination phases are each provided by plugins. Source plugins extract data from a data source in "rows", containing "properties". Each row is handed off to one or more process plugins which transform the row's properties. After all the properties are processed, the resulting row is handed off to a destination plugin, which saves the data.

A source plugin, one or more process plugins, and a destination plugin are brought together to extract, transform, and load (in the ETL sense) a specific type of data by a migration plugin.

Migration plugins

Migration plugin definitions are stored in a module's 'migrations' directory. For backwards compatibility we also scan the 'migration_templates' directory. Examples of migration plugin definitions can be found in 'core/modules/action/migration_templates'. The plugin class is \Drupal\migrate\Plugin\Migration, with interface \Drupal\migrate\Plugin\MigrationInterface. Migration plugins are managed by the \Drupal\migrate\Plugin\MigrationPluginManager class.

Source plugins

Migration source plugins implement \Drupal\migrate\Plugin\MigrateSourceInterface and usually extend \Drupal\migrate\Plugin\migrate\source\SourcePluginBase. They are annotated with \Drupal\migrate\Annotation\MigrateSource annotation, and must be in namespace subdirectory Plugin\migrate\source under the namespace of the module that defines them. Migration source plugins are managed by the \Drupal\migrate\Plugin\MigratePluginManager class.

Process plugins

Migration process plugins implement \Drupal\migrate\Plugin\MigrateProcessInterface and usually extend \Drupal\migrate\ProcessPluginBase. They are annotated with \Drupal\migrate\Annotation\MigrateProcessPlugin annotation, and must be in namespace subdirectory Plugin\migrate\process under the namespace of the module that defines them. Migration process plugins are managed by the \Drupal\migrate\Plugin\MigratePluginManager class. The Migrate module provides process plugins for common operations (setting default values, mapping values, etc.).

Destination plugins

Migration destination plugins implement \Drupal\migrate\Plugin\MigrateDestinationInterface and usually extend \Drupal\migrate\Plugin\migrate\destination\DestinationBase. They are annotated with \Drupal\migrate\Annotation\MigrateDestination annotation, and must be in namespace subdirectory Plugin\migrate\destination under the namespace of the module that defines them. Migration destination plugins are managed by the \Drupal\migrate\Plugin\MigrateDestinationPluginManager class. The Migrate module provides destination plugins for Drupal core objects (configuration and entity).

More information

Migration API documentation.

See also

Update API

File

core/modules/migrate/migrate.api.php, line 12
Hooks provided by the Migrate module.

Functions

Namesort descending Location Description
hook_migrate_prepare_row core/modules/migrate/migrate.api.php Allows adding data to a row before processing it.

Classes

Namesort descending Location Description
CckFieldPluginBase core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php The base class for all cck field plugins.
DestinationBase core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php Base class for migrate destination classes.
MigrateCckFieldPluginManager core/modules/migrate_drupal/src/Plugin/MigrateCckFieldPluginManager.php Plugin manager for migrate cckfield plugins.
MigrateDestination core/modules/migrate/src/Annotation/MigrateDestination.php Defines a migration destination plugin annotation object.
MigrateDestinationPluginManager core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php Plugin manager for migrate destination plugins.
MigratePluginManager core/modules/migrate/src/Plugin/MigratePluginManager.php Manages migrate plugins.
MigrateProcessPlugin core/modules/migrate/src/Annotation/MigrateProcessPlugin.php Defines a migration process plugin annotation object.
MigrateSource core/modules/migrate/src/Annotation/MigrateSource.php Defines a migration source plugin annotation object.
ProcessPluginBase core/modules/migrate/src/ProcessPluginBase.php The base class for all migrate process plugins.
SourcePluginBase core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php The base class for all source plugins.

Interfaces

Namesort descending Location Description
MigrateDestinationInterface core/modules/migrate/src/Plugin/MigrateDestinationInterface.php Defines an interface for Migration Destination classes.
MigrateProcessInterface core/modules/migrate/src/Plugin/MigrateProcessInterface.php An interface for migrate process plugins.
MigrateSourceInterface core/modules/migrate/src/Plugin/MigrateSourceInterface.php Defines an interface for migrate sources.