Problem/Motivation
I am getting this error when the `d6_field_instance_widget_settings` migration is executed:
[error] The "nodereference_url" plugin does not exist. (/var/www/html/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52)
The module in drupal 6 is https://www.drupal.org/project/nodereference_url
Steps to reproduce
Proposed resolution
Add mappings to d6_field and d6_field_instance_widget_settings.yml
Enable new module, nodereference_url, in the d6 fixture
Update tests. FieldDiscovery, MigrateField*, Functional
Remaining tasks
Add new field to testAddAllFieldProcesses
Remove changes to d6_field_instance_widget_settings.yml
Add the $this->pluginId . '_url' => 'entity_reference_autocomplete to getFieldWidgetMap
Add nodereference_url to the system table
Add a migration state entry for the new module
Update functional tests
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #56 | interdiff-55_56.txt | 708 bytes | gauravvvv |
| #56 | 3000717-56.patch | 11.63 KB | gauravvvv |
| #55 | 3000717-9.5.x_56.patch | 11.28 KB | gauravvvv |
| #45 | NodeReferenceUrl.png | 19.16 KB | quietone |
| #44 | 3000717-44.patch | 11.63 KB | quietone |
Issue fork drupal-3000717
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
edysmpComment #3
edysmpMaybe a bug report? My migration process is stopped with this error.
Comment #4
edysmpAdding to map.
Comment #5
heddnIs there any changes on the field side or only on the instance? And needs tests by adding a field of this type this to the test fixture, so back to NW.
Comment #6
edysmpFixing field side mapping.
Comment #9
anybodyHi, I just ran into the situation for a Drupal 6 to Drupal 8 Migration, the error still exists. Did anyone already test if #6 leads to a working migration? I'll try it.
Does someone know a test file as similar example to use to write tests for this? I don't know where to begin properly...
Comment #10
quietone commented@Anybody, thanks for asking!
For tests, data needs to be added to the Drupal 6 test fixture and then assertions added to \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldTest and \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldWidgetSettingsTest. There are some notes for working with the fixtures at https://www.drupal.org/docs/8/api/migrate-api/generating-database-fixtur....
If you have any questions asking in Drupal slack, #migration.
Comment #13
anybody@quietone: Thank you! As this was still on my list, but I currently don't have the time, I asked my teammate @Grevil, if he could have a look. He'll do his very best to help and might eventually contact you / #migrate users on Slack. Not that easy to get into this for the first time...
Thank you!
Comment #14
anybody@quietone: Just had a look at the Drupal 6 test fixture with @Grevil and I think we have a problem:
nodereference_url was a widely used Drupal 6 contrib module (discontinued) which would still be good to support for migration import in core.
But we'd have to install the module in Drupal 6 for the test fixture export to be clean, and I don't think that would make sense and would be a high price to pay? I don't think we want a contrib module as further Drupal 6 general dependency?
Especially because we map that old field / widget to a core default now...
Of course, we could also fake add the entries to the test fixture without installing the module, but I think that's even worse...
So no idea how to proceed here! Any strategy?
Comment #15
grevil commentedOk, I created an issue fork integrating the relevant fixture entries and tests. Since @Anybody mentioned in #14, that nodereference_url is just a contrib module and not mentioned in the contrib module list under https://www.drupal.org/docs/drupal-apis/migrate-api/generating-database-..., I created the fixture entries manually because I wouldn't want to export the d6 fixture with an "unauthorized" contrib module installed. While creating the manual entries, I have not created table entries for "locales_source", "i18n_strings", "menu_links" or "menu_router".
Note: The relevant commit is in the branch "3000717-missing-mapping"
Comment #17
anybodyComment #21
anybody@Grevil: Thanks! If these two commits are the right ones: https://git.drupalcode.org/project/drupal/-/merge_requests/2571/commits (top 2), then I'd suggest to
- Rebase that branch / MR or replay the changes again on the latest version, if it's easier.
- Close the other MR: MR!2572 (I'll do that now).
Afterwards, set to "Needs review". :)
Comment #23
anybodyRelevant changes (2 commits) from MR!2571 attached as patches if we should have trouble with rebasing! :)
Comment #26
grevil commentedI created a new branch "nodereference-url-missing-mapping-3000717", on base of 9.5.x and applied the fixture changes and patch #6.
Comment #27
grevil commented@quietone, @heddn, maybe you can have a look if everything seems fine?
Comment #28
grevil commentedComment #29
danflanagan8The tests are failing so I'm going to throw this one back to NW.
Comment #30
grevil commentedIf anyone needs the patch from #6 for 9.4.x, here it is.
Comment #31
anybodyComment #32
grevil commentedSorry, unnecessary patch, it did not apply locally because of other patches applied locally...
Comment #33
anybodyGreat, I found the left issue with the failing test. We have to increment the changed config count as we added field_company_4!
Comment #34
anybodyWohoo, tests are green :) @quietone, @heddn would you mind taking a look from outside?
Great work @edysmp & @Grevil!
Comment #36
benjifisherI am starting to review this issue. If it is still assigned to me a week from now, then feel free to un-assign it or re-assign it.
Near the changes in the upgrade test, I see these lines:
The comments are from 2017, and the lines that follow the comments are from 2021: #2565931: Handle long comment bundle names. It looks as though the comments need to be updated.
In order to avoid merge conflicts, we could add the unrelated comment update to the MR for this issue or we could create a follow-up issue once this one is fixed.
Comment #37
anybodyThanks @benjifisher, I'm not sure if I got you right, but I think that comment just explains why the following line has a return value of 14 and is not related to any other lines?
So I guess this should stay as it is?
Comment #38
benjifisher@Anybody: Sorry, I may have confused things by mentioning the comments. Fixing the comment is not in scope for this issue. We might do it anyway as part of this issue because fixing the comment separately could cause a merge conflict.
According to the comment, the number of comment types should be 1 + 12 or 13. That is what it was before #2565931: Handle long comment bundle names.
More relevant to this issue is a suggestion on Slack that maybe we do not have to add tests for this field type after all, despite what @heddn said in #5. The full transcript will be on #3318916: [meeting] Migrate Meeting 2022-11-10 2100Z soon, but for now here is part of what @quietone wrote:
Also, I asked,
Two more questions:
Has anyone reported manual testing of this patch?
Does this patch handle both the config migration and the content migration?
Comment #39
quietone commentedI have reviewed this, it has taken a while to remember a few things about Drupal 6 fields and migrate.
I read the code and ran the tests and everything looks fine. But something was bothering me and then I remembered about \Drupal\Tests\migrate_drupal\Kernel\d6\FieldDiscoveryTest and wondered why it wasn't changed. testAddAllFieldProcesses should include the new field and addAllFieldProcessesAltersData the new widget type.
The reason testAddAllFieldProcesses passes is that it does not include a count of all the fields, that is minor and was probably avoided some noise early in the development of the Migrate Drupal. addAllFieldProcessesAltersData passes because the mapping has been placed in the migration yaml instead of in \Drupal\migrate_drupal\Plugin\migrate\field\ReferenceBase::getFieldWidgetMap.
Then I reread the summary and a light bulb went off, this widget is provided by a Drupal 6 module that is new to the migration system. I have no objection to this being added but more changes are needed. The system table in the source fixture needs to change to include the module, a migration state entry is needed for the module, and various functional tests will need to be updated.
So, yes, tests are needed here.
Not directly. It is assumed that it is handled correctly by the FieldMigration and the getField* methods in \Drupal\node\Plugin\migrate\source\d6\Node.
Comment #40
quietone commentedI decided to make the changes myself. I was wrong about adding changes to ReferenceBase. I assumed that userreference_url was also supplied but it is not. Silly assumption given the name of the Drupal 6 module.
Comment #41
anybodyThank you so much @quietone, also, for all this helpful additional information.
And of course for working on this and creating the patch. It's really hard to get into all the details.
Indeed, see the issue summary, but a very common one, later replaced bay entity_reference.
Patch looks good, we'll also test it internally, currently the tests are waiting for the branch to pass.
Thank you so much once again!
Comment #42
benjifisherFrom the interdiff in #40:
I think this should add the
nodereference_urlto the list of modules that will be upgrade on/upgrade/review. It would be nice to take a screenshot while doing manual testing and add it to this issue.Comment #43
quietone commentedI don't think manual tested is needed. As far as I recall, we have not added screenshots of the placement of the Module name on the review page since the initiate commits of that feature. The process to add the Module name is well tested and the patch includes a test of the Review Page.
Comment #44
quietone commentedThis needed a reroll.
Comment #45
quietone commentedIn regard to #42, 'Node Reference URL Widget', is added to the list of modules that will be upgraded and it is tested.
To keep this moving I created a fresh D6 site, downloaded CCK and NodeReferenceUrl, and created content with a field that uses the url node reference widget. And here is a screenshot of upgrading that site from /upgrade
Comment #46
smustgrave commentedThanks @quietone, know we briefly spoke in slack about this one in the #migrate channel.
Change looks good and test coverage is there so think it's good.
Comment #48
quietone commentedTest failure on
Retesting.
Comment #49
smustgrave commentedRestarted the tests but that’s one of the random ones we see now
Comment #51
smustgrave commentedRandom failure.
Comment #52
larowlanCrediting @benjifisher
Comment #53
larowlanCommitted to 10.1.x, needs re-roll for 10.0.x and 9.5.x so marking it as patch (to be ported).
Comment #55
gauravvvv commentedAdded patch for 9.5.x
Comment #56
gauravvvv commentedTried fixing test fail
Comment #59
catchCommitted/pushed/cherry-picked the backport to 10.0.x and 9.5.x, thanks!