$entity->toUrl()->toString() can throw RouteNotFoundExeption

Created on 1 July 2025, about 1 month ago

Problem/Motivation

We had a config entity that had a canonical link template defined but no view builder. As a result, \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getCanonicalRoute does not define a route for it even though the link template exists.

\Drupal\entity_usage\PreSaveUrlRecorder::recordEntity doesn't catch that specific exception, but it probably should, just to avoid any issue.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇭Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024