Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
migration system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Aug 2021 at 06:39 UTC
Updated:
7 Feb 2022 at 23:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
quietone commentedOK, here is a start. Reviews welcome. Not running test because this is a doc only change.
Comment #3
huzookaWhat if we change also this line? I'd rather start this sentence with "A migration plugin instance..." It isn't crucial, but I've seen a lot of confusion already in regards of what is a plugin class, what is a plugin annotation, what is about a plugin definition, and what is an actual instance.
It would be nice to see some notes here about the migration yaml files (see the issue title). Something like
"Migration yml files in migrations subdirectories are plugin annotations written in Yaml format (they're are almost complete plugin definitions)..."
It's a label, not a description. See Migration::label:
Can this be somehow formulated as "process pipelines of the destination properties"?
Afaik nothing enforces that optional dependencies MUST be executed before running an actual migration.
See e.g. MigrationPluginManager@L191
$required_dependency_graph = (new Graph($required_dependency_graph))->searchAndSort();.TODO I guess.
Example with all keys misses
provider.Comment #4
quietone commented@huzooka, thanks!
This patch responds to all the points in #3.
Comment #5
joachim commentedLooks good, but a few typos:
I don't think 'annotations' is the right word here.
Should simply say 'Migrations are plugins defined ...'
Sentence doesn't read properly.
should be 'listing the migrationS'
missing plural 's' here too
'executeD'
I've been using 'dependencies' for this, probably because I saw it once elsewhere. Does that work too, or have I been doing this pointlessly?
Comment #6
huzooka@joachim, with respect:
dependenciesisn't a thing in in Migrate API's migration definitions/annotations (name they as you prefer).You're mixing these with Migrate Plus migration configuration entities.
And regarding to your #1 point: the word "plugin" is ambiguous. If you just say "plugin", then we don't know what do you refer. It might be a (base) plugin definition described by the yaml files (or the definition of a derivative), or a plugin instance created by the manager.
Comment #7
quietone commentedThanks for the reviews.
Changes for #6 2-6.
This sentence needs work and my brain is not up to it at the moment. Using YAML is only one way to create a migration plugin.
"Migrations are plugin annotations defined using YAML format and placed in the directory MODULENAME/migrations."
Comment #8
joachim commented> @joachim, with respect: dependencies isn't a thing in in Migrate API's migration definitions/annotations (name they as you prefer).
Yup, that's what I meant -- I've been using these incorrectly as they have no effect! Must be a leftover from config migrations. Thanks for the clarification.
> "Migrations are plugin annotations defined using YAML format and placed in the directory MODULENAME/migrations."
Annotations are metadata in source code comments. In Drupal, we use Doctrine Annotations, and they're the '@Foo{}' type syntax in PHP comments, and we use them to put plugin definitions in the same code file as the PHP class for that plugin.
The plugin definition is the annotation. But for a YAML plugin, the plugin definition is the YAML. The definition is an array of data. The *format* of that definition is either an annotation, or a YAML file. And the plugin itself is an instantiated object of a particular class, which holds the definition array.
> Using YAML is only one way to create a migration plugin.
Do you mean using plugin derivers?
I would put:
> Migrations are plugins defined as YAML files and placed in the directory MODULENAME/migrations.
and if we want to also mention using derivatives, we can do so further down.
We could link to the API topic on plugins (https://api.drupal.org/api/drupal/core%21core.api.php/group/plugin_api/9...) but that only mentions annotation plugins and not YAML, so it's not that relevant.
Comment #9
huzookaImho this is not true for migrations. Think about fieldable entity migrations: their definition contains the process pipelines of their fields as well, while their YAML file does not. And these field processes changing per derivative. If you get the instance of
d7_node_complete:article, and check its plugin definition, it will contain lot more then the corresponding (base)d7_node_complete.ymlfile.Comment #10
joachim commentedSo is provider actually a single-valued property? In which case, does it work the same as the provider in other plugins, where if it's not specified, it defaults to the module where the plugin is defined?
Comment #11
joachim commented> Imho this is not true for migrations. Think about fieldable entity migrations: their definition contains the process pipelines of their fields as well, while their YAML file does not. And these field processes changing per derivative. If you get the instance of d7_node_complete:article, and check its plugin definition, it will contain lot more then the corresponding (base) d7_node_complete.yml file.
That's true for all types of plugin. Derivatives change the basic definition.
I'm not sure we're actually arguing the same point here! I'm merely saying that the word 'annotation' refers to a particular thing and doesn't apply in the context of migration plugins.
Comment #12
quietone commentedAdding a note here to consider adding here or elsewhere the 'translations' property that can be used on the destination.
Comment #13
quietone commented#10. Yes. I got mixed up. It is the source plugins that can have multiple providers, See \Drupal\migrate\Plugin\Discovery\AnnotatedClassDiscoveryAutomatedProviders.
In the hope of making progress, I have changed the second paragraph to use the terminology from \Drupal\migrate\Plugin\MigrationPluginManager::getDiscovery where the migration yaml files are referred to as 'configurations'.
Not running tests because this is documentation only.
Comment #14
quietone commentedIn regard to #12, I added more @see directing to the destination plugins and source plugins in migrate module. I can't think of anything else to add here.
Comment #15
joachim commentedLGTM!
Comment #18
spokjeBack to RTBC per #15 after #3255836: Test fails due to Composer 2.2 solved the unrelated test failure.
Comment #19
alexpottCommitted and pushed ce85149c336 to 10.0.x and 85723106f69 to 9.4.x and 372a1fe0b78 to 9.3.x. Thanks!
Backported to 9.3.x as a docs improvement.