Follow-up to #2687003: Remove references to nonexistent functionality from migrate.api.php, #2676222: Move MigrationInterface out of the migrate\Entity namspace now they are plugins and #2625696: Make migrations themselves plugins instead of config entities

Problem/Motivation

Migrations are plugins no longer configuration entities - the docs have been fixed in #2687003: Remove references to nonexistent functionality from migrate.api.php to be more correct. However, exact what a migration plugin is and how it relates to source, process and destination plugins can be improved. Specifically:

#2687003-19: Remove references to nonexistent functionality from migrate.api.php by @xjm

Thanks @alexpott.

I applied the patch and read the whole docblock locally but I am still very confused: Are "migration plugins" a separate plugin type from source, process, and destination? If so, I think that we should explicitly state that Migrate uses four different types of plugins. Because on first read I thought "migration plugin" was a general header summarizing all three types, but the relationship between "migration plugins" and the source, process, and destination plugins is not clear.

I think this first paragraph is fine still:

 * @section overview Overview of migration                                      
 * Migration is an                                                              
 * @link http://wikipedia.org/wiki/Extract,_transform,_load Extract, Transform, Load @endlink                                                                  
 * (ETL) process. For historical reasons, in the Drupal migration tool the      
 * extract phase is called "source", the transform phase is called "process",   
 * and the load phase is called "destination". 

I do not think it needs to be directly followed by this exact paragraph:

 * Source, process, and destination phases are each provided by plugins.        
 * @ref sec_source extract data from a data source in "rows", containing        
 * "properties". Each row is handed off to one or more series of                
 * @ref sec_process, where each series operates to transform the row's          
 * properties in order to prepare them for the @ref sec_destination. After all  
 * the properties are processed, the resulting row is handed off to a           
 * destination plugin, which saves the data. Source, process and destinations   
 * plugins are brought together to extract, transform and load a specific type  
 * of data by @ref sec_migrations. Migration plugins also contain information on                                                                               
 * dependencies.

The information about plugins can easily be removed from that paragraph. What is important for the initial section is to define the terms "source", "process", "destination", "rows", and "properties". Whether they are plugins or not is implementation.

And if "migration plugins" are a separate category from the other three, then we need a much clearer definition of what they are, and I'd suggest a different name because it would seem to encompass all types of plugins involved in Migrate. If they are not a separate thing, then we should instead say that they are divided into three types.

I can try to help rewrite the docs too once I understand it.

And #2687003-20: Remove references to nonexistent functionality from migrate.api.php by @alexpott

I'm just going to try to write everything here.

A migration is the ability to extract something from the source, transform it to make it compatible with the destination and then load (save) it there. This whole thing in D8 is a MigrationPlugin. The different phases: extract, transform, and load are also plugins (which plug in to the Migration plugin - migrate is kinda like views in this respect). So there are four types of plugin:

  1. Migration plugins: \Drupal\migrate\Plugin\Migration : \Drupal\migrate\Plugin\MigrationInterface
  2. Source plugins: \Drupal\migrate\Plugin\migrate\source\SourcePluginBase : \Drupal\migrate\Plugin\MigrateSourceInterface
  3. Process plugins: \Drupal\migrate\ProcessPluginBase : \Drupal\migrate\Plugin\MigrateProcessInterface
  4. Destination plugins: \Drupal\migrate\Plugin\migrate\destination\DestinationBase : \Drupal\migrate\Plugin\MigrateDestinationInterface

I think that the Migration plugin is well named. If we ever have something that configures a set of migration plugins then you'll be plugging these in to set the whole thing up. I think it is shame that we didn't change the other plugins to match the ETL (extract, transform, load) language as that is the lingua franca of tools that perform similar tasks.

In a migration a row is extracted from source by the source plugin. The source can a Drupal 6 database, an XML file or whatever. The process plugins then transform properties of the row, or can mark it to be skipped (if deduping for example). Process plugins can also determine that a stub needs to be created - for example if a term has a parent of term that does not yet exist. Once the row has been transformed it is handed to the destination plugin that simply loads it into (saves) the Drupal 8 site. This whole ETL process is configured by the migration plugin.

Proposed resolution

Fix it

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#9 interdiff.txt1.4 KBquietone
#9 2755865-8.patch2.46 KBquietone
#6 2755865-6.patch1.86 KBquietone

Comments

alexpott created an issue. See original summary.

xjm’s picture

From the other issue:

The documentation still needs to introduce the migration plugins and their relationships to other kinds of plugins in a more clear way, because the new order does introduce new confusion. We will address that in the followup issue. Additionally, this new paragraph is very difficult to understand:

+++ b/core/modules/migrate/migrate.api.php
@@ -17,33 +17,30 @@
+ * Migration plugin definitions are stored in a module's 'migrations' directory.
+ * For backwards compatibility we also scan the 'migration_templates' directory
+ * too. 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.

It's unclear what the relationship between the sentences in this paragraph is. That will also be addressed in the followup issue.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Issue tags: -rc target
chx’s picture

> It's unclear what the relationship between the sentences in this paragraph is.

Same as any other similar plugin doxygen, there's a ton of them now (yay). This is not an explanation, this is a collection of pointers.

quietone’s picture

Status: Active » Needs review
StatusFileSize
new1.86 KB

Here's an attempt to clarify the relationship of the plugins largely based on the comment of alexpott in the IS.

mikeryan’s picture

Assigned: Unassigned » mikeryan
mikeryan’s picture

Assigned: mikeryan » Unassigned
Status: Needs review » Needs work
  1. +++ b/core/modules/migrate/migrate.api.php
    @@ -23,15 +23,18 @@
    + * source, process, and destination are also plugins, which plug in to the
    

    Rather than "which plug in to", how about "are managed by"?

  2. +++ b/core/modules/migrate/migrate.api.php
    @@ -23,15 +23,18 @@
    + * process, migration, source, process and destination.
      *
    

    A colon rather than comma after the first process would make this clearer.

Also, the source plugin section, note that we now have a source-specific plugin manager MigrateSourcePluginManager.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB
new1.4 KB

Fixed items 1 and 2 and updated the source plugin section to refer to MigrateSourcePluginManager.

mikeryan’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This is an improvement. Nice work everyone. Committed and pushed ed730ba to 8.3.x and dfadd97 to 8.2.x. Thanks!

  • alexpott committed ed730ba on 8.3.x
    Issue #2755865 by quietone, mikeryan, alexpott, xjm: Describe Migration...

  • alexpott committed dfadd97 on 8.2.x
    Issue #2755865 by quietone, mikeryan, alexpott, xjm: Describe Migration...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.