Problem/Motivation
They currently do not, and it causes a lot of weird acrobatics and unsavory hacking in Migrate's tests. The way around this problem, in my opinion, is the path through the jungle: add proper dependency injection to all Migrate source plugins in core and, ultimately, completely remove all mentions of \Drupal from SourcePluginBase and its many descendants.
Steps to reproduce
Proposed resolution
Remaining tasks
Make a new patch here for migrate and move relevant parts of the patch to #2853647: Migrate Drupal source plugins should use dependency injection
User interface changes
N/A
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#51 | interdiff_50-51.txt | 686 bytes | immaculatexavier |
#51 | 2791041-51.patch | 32.84 KB | immaculatexavier |
#50 | interdiff_49-50.patch | 8.64 KB | immaculatexavier |
#50 | 2791041-50.patch | 32.8 KB | immaculatexavier |
#49 | reroll_diff_34-49.patch | 39.39 KB | immaculatexavier |
Comments
Comment #2
phenaproximaHere's a start. This will break a huge number of tests.
Comment #3
phenaproximaForgot to inject the module handler into SourcePluginBase.
Comment #6
phenaproximaOK, this provides a few necessary mocked services in MigrateSqlSourceTestCase, and removes a couple of protected wrappers around \Drupal.
Comment #8
phenaproximaThis should fix most, if not all of the remaining failures.
Comment #10
phenaproximaNearly there. This one should pass everything.
Comment #11
phenaproximaDang, there was one more I missed.
Comment #13
heddnHow or does this effect contrib and custom source plugins? Me thinks it wouldn't.
Comment #14
phenaproximaAny SourcePluginBase subclasses that use ContainerFactoryPluginInterface, or are calling parent::__construct() -- which they should be doing -- will break because the arguments to the constructor have changed for all of SourcePluginBase's descendants. It's extremely likely that virtually all source plugins in contrib, and any custom ones as well, will be extending it since it does a lot of important and complicated stuff (particularly in its Iterator methods).
Comment #15
mikeryanMoving to 8.2.x - we are trying very hard to stop BC breaks (move migrate to experimental beta status and commit to a stable API) with 8.2.
Comment #17
phenaproximaComment #18
shashikant_chauhan CreditAttribution: shashikant_chauhan as a volunteer and at Iksula commentedCreated patch from patch 11 for branch 8.2.x
Comment #19
heddnIf this is going to get into migrate, then this will need to get in before it bumps from experimental.
Comment #20
heddnDiscussed with @phenaproxima and removing this as a blocker from beta. While it is a BC break, it should not block beta.
Comment #21
iMiksu#18 needs reroll.
Comment #22
shashikant_chauhan CreditAttribution: shashikant_chauhan as a volunteer and at Iksula commentedadding updated patch.
Comment #24
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedComment #25
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment #26
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-roll (but will still fail tests - further patch pending...).
Comment #27
jofitz CreditAttribution: jofitz at ComputerMinds commentedSet missing module handler property of SourcePluginBase.
Comment #29
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment #31
jofitz CreditAttribution: jofitz at ComputerMinds commentedCorrect final 2 test failures.
Comment #33
quietone CreditAttribution: quietone as a volunteer commentedLet's make this similar to the process plugin documentation.
s/Expects at least two configuration values:/Available configuration keys:/
Remove blank line.
s/'data_rows'/data_rows/
Remove blank line.
s/'ids'/id/
Comment #34
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment corrections made.
Comment #35
heddnI don't see how this can be done without breaking BC.
Nit: not sure we need all this extra whitespace here.
This feels like a BC break. Lots of contrib and custom migrations extend from SqlBase and might be calling parent. With this addition, it will break them.
Comment #36
phenaproximaThis is a big fat BC break (I knew that when I wrote it), and Migrate is now in beta.
This cannot be done in Drupal 8. Regrettable, but we'll live.
Comment #37
joelpittetDiscussed with @phenaproxima in IRC and followed up with splitting out the migrate_drupal part since it's not in beta yet.
#2853647: Migrate Drupal source plugins should use dependency injection
Comment #38
phenaproximaThis will need a reroll once #2853647: Migrate Drupal source plugins should use dependency injection lands. And, y'know, once we start working on Drupal 9.
Comment #39
heddnLet's postpone this.
Comment #41
xjmThis would be a minor-only change (and it would need to be done with BC/deprecation). Since 8.9.x and 9.0.x are now in beta, I'm moving this to 9.1.x. Thanks!
Comment #42
Sahil Khambra CreditAttribution: Sahil Khambra as a volunteer and at Trigyn Technologies Ltd for Drupal India Association commentedI am taking this issue and try to resolve this.
Comment #43
Sahil Khambra CreditAttribution: Sahil Khambra as a volunteer and at Trigyn Technologies Ltd for Drupal India Association commentedComment #46
DamienMcKennaThere has not been progress in a year, so I'm unassigning it.
Comment #49
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedReroll patch against 9.5
Attached reroll diff against #34
Comment #50
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedReroll patch against #49
Attached interdiff
Comment #51
immaculatexavier CreditAttribution: immaculatexavier as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedReroll patch against #50
Attached interdiff
Comment #53
quietone CreditAttribution: quietone at PreviousNext commented@immaculatexavier, thanks for working on this issue! Have a look at the instructions for running the coding standard checks locally so you can be sure the tests will run before uploading a patch. It also has the advantage of saving resources, including money, for the Drupal association. There are real costs for running the tests.
It is good practice to test any tests that your patch changes before uploading your patch to an issue. Running PHPUnit tests.
According to #38. This will need a reroll after
#2853647: Migrate Drupal source plugins should use dependency injection. The other issue is not yet committed. The work in the latest patch includes work that should be in the other issue.
This is needs work to move the migrate_drupal parts to the other issue.
Comment #54
quietone CreditAttribution: quietone at PreviousNext commentedActually, because of #20 in the other issue, I am postponing until discussed at a migrate meeting. I have added a comment to #3281351: [meeting] Migrate Meeting 2022-05-26 2100Z.