Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It's confusing when you see $migration in the transform() method because you're not sure at first whether it means the current migration, or the lookup migration.
You can deduce it from this:
$migrations = $this->migrationPluginManager->createInstances($migration_ids);
foreach ($migrations as $migration_id => $migration) {
but it would be better DX to call these $lookup_migrations => $lookup_migration
Comments
Comment #2
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is a patch.
Comment #3
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #4
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedHi @mahesh thanks for the patch I can confirm this applies cleanly on branch 8.6.x-dev.Just one small thing for joachim may be....
Hi @joachim do you think using $migration_lookups instead of $lookup_migrations and $migration_lookup instead of $lookup_migration makes more sense while naming this variable, the name of file being ../MigrationLookup.php
Comment #5
joachim CreditAttribution: joachim as a volunteer commented> Hi @joachim do you think using $migration_lookups instead of $lookup_migrations and $migration_lookup instead of $lookup_migration makes more sense while naming this variable, the name of file being ../MigrationLookup.php
To me, the class name MigrationLookup is about the action: a lookup using a migration.
Whereas $lookup_migrations is some migrations which are used for lookup.
Comment #6
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedComment #7
quietone CreditAttribution: quietone as a volunteer commented@msankhala, thanks for the patch. Clarifying code is always welcome.
On review I have one question and one change.
The transform method begins with this block where $migration_ids refers to the migrations to be looked up, which the suggestion is to call them $lookup_migration. So, shouldn't this be changed to $lookup_migrations_id and $lookup_migrations_ids?
This should be moved to the line before $lookup_migrations is first used.
Comment #8
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHi @quietone, Thanks for the review. Yes I agree with your suggestion about moving
/** @var \Drupal\migrate\Plugin\MigrationInterface[] $lookup_migrations */
right above $lookup_migrations is first used.Actually, it was already there so I left it unmodified. But I am happy to modify it.
Yes, calling them
$lookup_migrations_ids and $lookup_migration_id
make more sense. It was not explicitly mentioned in scope of the issue so i left it.I would like to know @joachim's opinion on this.
Comment #9
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedremoved duplicate comment.
Comment #10
quietone CreditAttribution: quietone as a volunteer commented@msankhala, thanks for continuing to work on this.
I think it is ok to go ahead and make the changes. Why? Because when I read the issue it states that the meaning of $migrations is deduced from reading the foreach block not that the change is limited to foreach block.
For the inline @var I mean that that should be zero lines between it and where $lookup_migrations is first used. When I apply the patch there are 2 intervening lines.
Comment #11
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is updated patch.
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedassigning for review
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedInstalled the patch and read the code. Much better and easier to follow. I was troubled for a while with the double plural of 'lookup_migrations_ids' but since there could be multiple migrations to lookup and they could have multiple ids, it make some sense. So, yes let's move this along.
And the inline doc comment was moved as well.
Comment #15
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedLooks like testbot hickup. Rescheduling test.
Comment #16
maxocub CreditAttribution: maxocub as a volunteer commentedBack to RTBC.
Comment #18
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedThis is kind of weird. Why test boat is only showing
PHP 7 & MySQL 5.5 Build Successful
instead of showing the number of tests being passed. Any idea?Comment #19
maxocub CreditAttribution: maxocub as a volunteer commentedI think the testbot failures have been resolved, back to RTBC.
Comment #21
lomasr CreditAttribution: lomasr at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedPatch applied cleanly not sure why it failed by testbot.
Comment #22
lomasr CreditAttribution: lomasr at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedComment #23
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedI'll check if patch needs reroll. Here is failure reason.
Comment #24
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedYes this needs reroll.
Comment #25
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #26
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedMigrationLookup file recently changed in https://cgit.drupalcode.org/drupal/commit/core/modules/migrate/src/Plugi...
Here is the rerolled patch.
Comment #27
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedComment #28
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedChange in MigrationLookup is reverted now https://cgit.drupalcode.org/drupal/commit/core/modules/migrate/src/Plugi...
See https://www.drupal.org/project/drupal/issues/2865247#comment-12625399
Comment #29
quietone CreditAttribution: quietone as a volunteer commentedAdding reroll tag
Comment #30
leolandotan CreditAttribution: leolandotan as a volunteer and at Promet Source commentedI'll work on the reroll of this patch.
Comment #31
leolandotan CreditAttribution: leolandotan as a volunteer and at Promet Source commentedHi guys,
I have rerolled the patch following Rerolling patches and Rerolling patches: Failed Rebase. Unfortunately, there was a conflict when I did the reroll specifically in what @msankhala shared from https://cgit.drupalcode.org/drupal/commit/core/modules/migrate/src/Plugi.... Basically the change conflicts fixes were to:
Hope everything is in order.
Thanks!
Comment #32
heddnThis re-name will definitely make it easier to read the code. Great fixes.
Comment #34
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedLooks like an issue with test bot. Putting it to Need review again. Once passed it is ready for RTBC.
Comment #35
maxocub CreditAttribution: maxocub as a volunteer commentedTests are green, back to RTBC.
Comment #37
quietone CreditAttribution: quietone as a volunteer commentedAdd tag for DX and change title
Comment #38
alexpottThis is definitely an improvement but I think if we're addressing all the
$migration(s)
confusion we have one more thing to address:I think we should consider renaming
$migration
here too. Because it's not always the $migration in progress. Maybe we should go for something like$stub_migration
?Comment #39
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedHere is the updated patch as per @alexpott suggestion in #38.
Comment #40
heddnLooks good to me. Feedback in #38 is addressed.
Comment #41
catchCommitted 37f6cce and pushed to 8.7.x. Thanks!
Comment #43
maxocub CreditAttribution: maxocub as a volunteer commented