Problem/Motivation
Working on #2746541: Migrate D6 and D7 node revision translations to D8 I was getting the following error, see https://www.drupal.org/pift-ci-job/1411173
1) Drupal\Tests\taxonomy\Kernel\Migrate\d6\MigrateTaxonomyVocabularyTranslationTest::testTaxonomyVocabularyTranslation
Undefined index: id
The undefined index is because it is trying to write to $definition['d6_term_node_translation:1'] which does not exist. It would exist if content_translation was enabled, but it is not in the test. The d6_term_node_translation plugin is added to the list to alter if config_translation is enabled but that migration is in content_translation so it is not in $definition.
Also, the plugin alter assumes that the all the ids it writes to exist in the $definition array. I reckon that should that be changed.
Proposed resolution
Add d6_term_node_translation if content_translation is enabled. Or should it be both config_translation and content_translation?
Add a check that the definition exists before writing to it
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff.3082719.12-22.txt | 627 bytes | mikelutz |
#22 | 3082719-22.drupal.reroll_for_8_7.patch | 11.14 KB | mikelutz |
#12 | 3082719-12.patch | 11.13 KB | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedNot sure if config_translation should be checked or not. And looking at the history, I was the one to add it in #2859297: Migrate taxonomy term references for D6 Node translations. Seems to me it should only check for content_translation. Is that correct?
The attached patch checks that the definition exists before writing to it and it adds d6_term_node_translation if both config_translation and content_translation are enabled.
Comment #3
Ghost of Drupal PastMaybe we could use
foreach (array_intersect($plugin_ids, array_keys($definitions)) as $plugin_id) {
? I am not sure which one is better, just offering an idea, feel free to ignore.Comment #4
quietone CreditAttribution: quietone as a volunteer commentedYes, I like that change. Thx.
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedNow let's change the test to determine if translation is available from testing if config_translation is enabled to testing if content_translation is enabled. The test should fail because content_translation is not enabled in the test and thus the d6_term_node_translation migration is not discovered.
edit: make the first sentence clearer
Comment #7
mikelutzCan we add a test that tests this scenario and ensures the migration definition is not altered if it doesn't exist?
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedAdding a test.
Comment #9
quietone CreditAttribution: quietone as a volunteer commentedAdding migrate critical tag because this is needed in #2746541: Migrate D6 and D7 node revision translations to D8 an already large patch with a different scope.
Comment #11
NickDickinsonWildeLooks good to me.
One very minor standards issue which can be fixed on commit IMO:
should be ...['vid']...
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedSorry, I missed that. Here is the fix.
Comment #13
mikelutz+1 to RTBC, pending tests.
Comment #14
mikelutzComment #15
quietone CreditAttribution: quietone as a volunteer commentedI think this is actually a blocker to #2746541: Migrate D6 and D7 node revision translations to D8
Comment #16
Gábor HojtsyComment #19
Gábor HojtsyThanks all, looks good and straightforward.
Comment #20
xjmI think this broke 8.7.x:
https://www.drupal.org/pift-ci-job/1429277
(All environments are failing on 8.7.x but not 8.8.x.)
Reverted against 8.7.x and retesting against that branch.
Comment #22
mikelutzHere's the reroll for 8.7. Prior to #2926068: Deprecate system_rebuild_module_data() and remove usages in core the module handler in core incorrectly depended on the system module.
Comment #23
heddnWe're fine again.
Comment #24
alexpottDo we need to do this in 8.7.x? - #2746541: Migrate D6 and D7 node revision translations to D8 will only land in 8.8.x
I think this issue should be marked fixed and set to 8.8.x.
Comment #25
catchAgreed with #24, moving back to 8.8.x and fixed.