this was originally posted in #2350797: Orphaned menu links when nodes are deleted if menu_link_ui is not enabled. I don't know if a regression of critical bug fix is critical but I'm opening this as such, please fix if incorrect.
I've found a new problem that comes with this (the fix of #2350797: Orphaned menu links when nodes are deleted if menu_link_ui is not enabled). Module uninstall is broken if configuration is being deleted during the uninstall. Here is one example how to reproduce:
- Install Drupal using the standard installation profile
- Download & Enable token contributed module
- Try to uninstall menu_link_content module
This gives error Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("entity_type_id") to generate a URL for route "entity.entity_view_mode.add_form".
I was able to reproduce this with drush and from UI.
(See also, comment #3, re: getting this error during automated site installation + config import.)
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | interdiff.txt | 3.55 KB | joelpittet |
| #17 | 2907654-17.patch | 3.71 KB | joelpittet |
| #17 | 2907654-17-test-only.patch | 2.98 KB | joelpittet |
| #12 | interdiff-12.txt | 718 bytes | amateescu |
| #12 | 2907654-12.patch | 3.38 KB | amateescu |
Comments
Comment #2
mikran commentedComment #3
patrick r. commentedRan to this issue as well after updating to 8.4.0-rc1 when doing an automated drush site-install with the current configuration of my project being imported after installation for testing purposes. After some investigation I also managed to trigger that exception by simply executing
drush eval 'print_r(Drupal\Core\Entity\Entity\EntityViewMode::load("node.teaser")->uriRelationships());'on the command line. I think the problem might be that neither Drupal\Core\Entity\Entity\EntityViewMode nor Drupal\Core\Entity\EntityDisplayModeBase is extending Drupal\Core\Entity\Entity::urlRouteParameters() to provide the "entity_type_id" parameter for the "entity.entity_view_mode.add_form" route. Attaching a small patch which does just that.Comment #4
amateescu commentedJust closed a duplicate issue: #2908138: Core media module uninstall fails
There's a patch here so let's test the patch in #3.
Comment #5
mpp commentedQuite possible this one is a duplicate as well: https://www.drupal.org/node/2908021
The patch in #3 solved the issue for me. I assume the patch needs a test before it can get committed.
Comment #6
catchYes let's add test coverage.
Comment #7
fellaroon commentedlet us start a test coverage .
Comment #8
alisonEDIT: Crumbs, I copied/pasted carelessly and didn't even notice... Take 2...
(^^ comment #3) Me too!!!!! I will try the patch in a moment and report back. (I had been thinking that this had something to do with the Entity Schema changes in 8.4.0-rc1, or maybe it was in beta1, but this makes more sense; trying not to get my hopes up :D )
Comment #9
alison(I hope this title change is okay; I wanted to reflect that this happens when installing sites with existing configurations, per #3; obviously feel free to change again!)
Comment #10
alisonMinor update to issue summary, just to mention the site installation + config import scenario from#3 (which is how I encountered the problem myself).
Comment #11
_randy commentedConfirmed patch in #3 solved the issue. Specifically mine was uninstalling the media module in D8.4-RC1.
Comment #12
amateescu commentedThe patch in #3 is mostly correct, we just need to make sure that we only provide the extra route parameter when we need it.
Here's a test for this. The interdiff does not include the new test coverage :)
Comment #15
joelpittet@amateescu, another guess that is probably too simple but could you compare the internal path instead of the full URL?
$view_mode->toUrl('edit-form')->getInternalPath()and remove the prefix /Comment #16
joelpittetI'll tackle my suggestion
Comment #17
joelpittetI replaced the paths with routes as Url objects. Seems to work well in local testing.
Comment #19
iryston commentedConfirmed patch #3 as well as #17 (2907654-17.patch) solved the issue. Successfully uninstalling the comment module in Drupal 8.4-dev
Comment #20
catchNice straightforward test addition, moving back to RTBC.
Comment #22
catchCommitted/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!
Comment #24
alisonI think I'm still fine / I'm guessing (hoping) that this isn't a thing, but *just in case*..........
After updating to 8.4.0-rc2 (from rc1), and then also I had a couple config changes (a pathauto pattern, added a menu link to a view, site name tweak) -- the next time I ran
drush cim, the import went fine, but I got an error that looked suspiciously similar to the stuff going on in this issue thread. Next time I ran a config import (albeit not the same config changes), no errors, so that's good. I should probably test with the same config import as the first time when I got the errors, but alas, I'm just pasting the error details here, for now anyway :) (If anyone thinks there's something to this, I will definitely recreate the situation and see if the error happens again, just lmk.)Comment #25
wim leersThe title here is far broader than what the fix entails — this was a fix only for
EntityViewModeandEntityFormModeentities.Comment #26
wim leersAs an unexpected side effect, this also unblocked #2843780 — see #2843780-32: EntityResource: Provide comprehensive test coverage for EntityFormMode entity. In that issue, we (or at least I) didn't realize there was a bug in the entity class for
Entity(Form|View)Mode; now that that is fixed, that issue is also unblocked, hurray! And so is #2843781: EntityResource: Provide comprehensive test coverage for EntityViewMode entity!Comment #27
Anonymous (not verified) commentedYep, renaming greatly helped this! 🙏