Problem/Motivation
If there is a link template with mandatory parameters the url cannot be generated without providing those parameters. If we try to build the url without the mandatory parameters the exception Symfony\Component\Routing\Exception\MissingMandatoryParametersException
will be thrown.
The entity predelete hook menu_link_content_entity_predelete
introduced in #2350797: Orphaned menu links when nodes are deleted if menu_link_ui is not enabled is the one that introduced the problem by calling \Drupal\Core\Entity\EntityInterface::uriRelationships()
.
This might occur if the diff module is used and a link template like this is added:"revisions-diff" = "/custom_entity/{custom_entity}/revision/{left_revision}/{right_revision}/{filter}"
This is a major as it prevents deleting entities having such link templates and there is no workaround for this.
Proposed resolution
\Drupal\Core\Entity\EntityInterface::uriRelationships()
should catch exceptions of the type MissingMandatoryParametersException
.