Problem/Motivation
As part of the roadmap of getting migrate tools and upstream drush to play nice together again, we need to provide an easy way to provide shared configuration.
Steps to reproduce
Proposed resolution
This provides a new yaml plugin type that injects itself into the migrate yaml.
Example syntax of new yaml plugin in MODULE_NAME.migrate_shared_configuration.yml:
my_default_configuration:
source:
batch_size: 2
Example syntax of an include in a migration.yml:
id: test_stub_migration
label: Test stub migration
include: my_default_configuration
source:
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff_24-26.txt | 3.77 KB | heddn |
| #26 | 3250040-26.patch | 16.2 KB | heddn |
| #10 | 3250040-10.patch | 18 KB | andregp |
Comments
Comment #2
heddnComment #3
heddnNW to rename the plugin to "migrate_include/MigrateInclude". Tagging novice, because code refactor like what I just mentioned should be PHP novice stuff.
We should also point to
src/SharedConfigIncludeHandler.php(which should be renamed tosrc/MigrateIncludeHandler.php). From here.We should add some documentation here on how this should be invoked in a migrate yaml. Examples of a single and multiple includes would be good.
Comment #4
heddnIs migrate_tools the right place for this module? Should it move to plus? Should it be in a new module namespace entirely? I really don't like that last option. It seems troublesome for discoverability of the feature. Plus is maybe the right place. But we're introducing it for the sake of tools, so we can (re)move some of the drush commands into upstream drush.
Comment #5
andregp commentedI'll start to work on this issue. I'll begin with the refactoring and the other changes mentioned in comment #3.
Just to be sure @heddn do you want to change even the module name too, right?
I'm novice on PHP and Drupal but will try my best. I may finish it by tonight or tomorrow.
Comment #6
heddnI wouldn't do any module naming changes. Those can be done after #3 is addressed.
Comment #7
andregp commentedHi @heddn I hope it is useful, this is basically the first issue I'm trying to solve by myself. Please let me know if I made something wrong on the refactoring and how I can improve. All the best!
Comment #8
heddnhi @andregp, I think you tried to do a module name change? Let's reverse those parts. And only rename the plugin & classes. Also, when doing incrimental changes like this, an interdiff is really helpful.
Comment #9
andregp commentedOh sorry, I'll do it then.
Comment #10
andregp commentedThanks for being so patient, so here is the new patch where I changed the MigrateTools class name and refactored the code accordingly. Also an interdiff between this and your patch.
Just in case I also made another patch that includes changes on MigrateToolsTest, MigrateToolsCommands, and MigrateToolsCommandsTest classes names whit a respective interdiff.
Please tell me if I missed something.
Comment #11
heddnThis file should not be renamed. Rolling that back would clear up even more noise in the patch.
Comment #12
andregp commentedOkay
Comment #13
andregp commentedSo I undid the rename on MigrateToolsCommands.php file. Here is the patch and the interdiff
Comment #15
andregp commentedSorry forgot one place
Comment #16
heddnThis shouldn't rename. It will greatly reduce the noise in this patch too if you back out that change.
Comment #17
andregp commentedAre you referring to the change only on that line from MigrateToolsCommands.php? Or do you mean that I also shouldn't rename Drupal\migrate_tools\MigrateTools.php class name to Drupal\migrate_tools\MigrateInclude.php ?
Comment #18
heddnDon't rename MigrateTools utility class.
Comment #19
andregp commentedI'm sorry, I clearly misunderstood the issue. I thought that renaming the class MigrateTools was part of renaming the module. I apologize.
Here is the new patch where I backed out this change.
Comment #20
heddnThis is passing green locally. I want to get some feedback on it, but I think it is a distinct possibility this will let us get to a place where migrate tools and drush 10.4+ can co-exist again.
Comment #21
heddnAlso, refer to the linked change record for more fully details on how this patch would work. And any input on what version 5.2 or 6.0 this feature should be released into.
Comment #22
mradcliffeDoes migrate_tools need to add its own schema file in order to modify the migrate_plus config_entity schema to account for the new key?
Something like the following, right?
Comment #23
heddnre #22:
Migrate_tools could add a schema entry. But it isn't strictly required. You can use shared config with migrate plus config entities or with core's yml based migrate plugins. I'm using less and less of migrate plus config entities these days, so I hadn't really thought about needing a schema entry. Does it need one?
Comment #24
heddnI'm leaning towards put this into a 6.x branch so I don't have to worry about breaking as many things. Ergo, bumping a few things in the composer.json/.info.yml.
Comment #26
heddnComment #28
heddnAutomated testing will fail until Drush 11.0.6 is released. But those failures are related to issues in Drush's testing classes, not the classes under test. Tests pass as-is with Drush ^10.6 on local. Watch for a quick-follow to make the code work with PHP 8.1.