Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Mar 2016 at 06:30 UTC
Updated:
4 Dec 2018 at 12:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chx commentedComment #3
chx commentedComment #4
benjy commentedWe might even have unit tests for this already
Comment #5
chx commentedSo. much. boilerplate.
Comment #7
chx commentedWe picked a custom plugin instead at the end so I will not be finishing this core patch. I am very strictly only working on client required patches.
Comment #9
imiksuTesting if needs reroll and had some offset. Updating patch.
Comment #11
heddnLet's pend this on #2845483: Rename Iterator process plugin and add documentation.
Comment #12
nevergonePatch re-rolled, please review. 8.4.x and 8.3.x attached.
Comment #13
gábor hojtsyDefinitely needs tests still. Also for someone who is not well versed in migrations:
This passes in both $this->configuration and $this->sourceConfiguration. Neither were passed earlier. What is the role of each and why do we need both?
Comment #14
heddnThe reason for passing both config and source is mentioned in the IS. But it could be clearer.
Could use better docs on this variable to address the question in #13.
This isn't called Iterator any more.
Comment #15
heddnComment #16
jofitzAddressing @heddn's comments in #14.
Still needs tests.
Comment #17
heddnNW because needs tests. But #16 is looking good.
Comment #19
jofitzAdded tests.
No interdiff because the only change is adding the tests.
Comment #22
maxocub commentedCoding standard asks that the docblock summary be on only one line.
Params are missing a description.
A comment explaining why we are doing this would help here.
Comment #23
mohit1604 commentedPatch #19 no longer apply.
Comment #24
mohit1604 commentedComment #25
mohit1604 commentedComment #26
maxocub commentedThanks for the re-roll @mohit1604, back to NW for #22.
Comment #27
jgrunert commentedAdded comments as per #22
Comment #28
jgrunert commentedComment #29
heddnPretty close. Just small stuff.
As a side note typically interdiffs are uploaded with a .txt extension. That wouldn't be readily apparent though, since our docs are out of sync with the norm. That's now fixed now: https://www.drupal.org/documentation/git/interdiff
Nit: sentence need a closing stop, also known as a period.
Back to NW for the small nit.
Comment #30
jgrunert commentedReworked one comment for proper punctuation and line length.
Comment #31
heddnI was about to RTBC, then I noticed something important. We aren't actually passing in the source config. We're passing in source values. This is a subtle but important distinction. This means we have access to statics and all other values in the source. Which is really what we want. But that also means we need to rename variables, tests, etc. to align with reality And the docs should b focused on the source values, not on a specific subset of those values. No need to mention statics at all.
This deserves a comment. Uncommenting plugin and process make some sense to me. But why key? Let's explain why for all, just to make it super clear.
Comment #32
SilviuChingaru commentedYou can always use something like this to obtain constants behaviour in sub_process plugin:
Comment #33
phenaproximaSlightly alternative approach here. I ran into a situation where I needed the source ID values from the parent row, and @heddn directed me to this issue. I decided to introduce two new configuration options to the SubProcess plugin -- include_source_id_values and include_source_constants. When include_source_constants is set, only the source plugin constants will be added to the sub-processed row, rather than the entire source configuration.
I figured it was better to introduce this behavior behind config flags, in order to maintain BC.
Comment #34
phenaproximaThis blocks the migration from Panelizer to Layout Builder (see #2969376: [META] Migration path to Layout Builder).
Comment #35
heddnThis won't work. Constants are /typically/ prefixed with the word "constants". But that is only by convention and convenience. Let's not add the complexity of this and just pass everything.
Comment #36
phenaproximaDiscussed with @heddn on Slack and we decided that it would be better to copy all source configuration into the sub-processed row, since not everybody prefixes their source constants with 'constants'. I insisted on prefixing the copied source configuration, though, to avoid unintentional wonkiness. The prefix defaults to 'source_configuration', but can be overridden.
Still needs test coverage.
Comment #37
heddnNit: let's say include_source_values. And pass all values, instead of just the config. That was the original need for this issue.
OR, have a config and a source values option. But I insist on a source values option too.
Comment #38
phenaproximaThat sounds reasonable. Back to the ol' drawing board.
Comment #39
heddnComment #40
dylan donkersgoed commentedI'm attaching an updated version of the patch that brings in source values as well. I did add them to a separate key.
I've done some manual testing of it but haven't expanded the automated tests, so I'm leaving it at "Needs Work" for now. Honestly not sure quite how to bring in source values to test. Drupal 8's automated testing stuff is still somewhat alien to me, especially when you bring the database into it. I'll try to come back to this and add them later when I have some time to look at it properly.
Comment #42
heddnI've responded to my own points. This fixes the tests and merged things down to a single set of context values called, 'source'. And this context values can be renamed if the 'source' doesn't make sense.
This results in yaml of this form, where the value of baf in the source becomes the values of baaa inside of the sub_process plugin.
Comment #44
heddnThis is a more sane approach. Plus fixes some tests.
Comment #45
maxocub commentedI really like this new simpler approach. The patch looks good to me. Let's move this forward.
Comment #46
alexpottHow come we need to implement ContainerFactoryPluginInterface? This gives us the $migration property but we never appear to use it?
Comment #47
heddnGood question. We can probably remove that. Removing the interface and the constructor is definitely a novice programming task. And fixing the tests so they don't inject that variable is probably too. So tagging novice.
Comment #48
heddnComment #49
bendeguz.csirmaz commentedRemoved.
Comment #50
phenaproximaThanks! Back to RTBC we go.
Comment #51
catchCommitted 971c946 and pushed to 8.7.x. Thanks!