Issue #3613844: The collection link template of the domain entity type points to a route that does not exist

Declares the route name that core derives from the collection link relation as an alias of the domain listing route.

Problem

The domain entity type declares a collection link template pointing at /admin/config/domain, but core derives the route name from the relation (EntityBase::toUrl()), so it looks for entity.domain.collection, while the module declares that path under the name domain.admin. The result is that hasLinkTemplate('collection') returns TRUE while toUrl('collection') throws RouteNotFoundException, so any generic entity code that follows the declared link template breaks.

Fix

Core solved the same problem for its own entity types by aliasing the derived name to the legacy route: entity.node.add_form: {alias: node.add} in node.routing.yml, and entity.block_content_type.add_form in block_content.routing.yml. This MR does the same:

entity.domain.collection:
  alias: domain.admin

Aliases are resolved by name in RouteProvider::getRouteByName() and excluded from path matching in getRoutesByPath() (alias IS NULL), so:

  • toUrl('collection'), Url::fromRoute('entity.domain.collection') and every consumer of the declared link template now work, which is the reported bug;
  • /admin/config/domain is still served by domain.admin, so every base_route: domain.admin local task, every parent: domain.admin menu link, the hook_help() case and every third-party Url::fromRoute('domain.admin') call keep working unchanged.

No rename, no deprecation, no BC break, and nothing for dependent modules to do.

Tests

Two methods added to the existing DomainUrlTest: one asserting that the collection relation resolves to the listing path for both route names, and one asserting that the alias is not path-matched, which is what would silently detach local tasks, local actions and hook_help() if it ever were. Both were verified failing without the routing change and passing with it, on core 11.4.4.

Not done here

  • The 3.x branch has the same latent bug but is untouched: route alias support landed in core 11.2, and 3.x still supports ^10.2, where an alias: entry has no handler and raises a TypeError during the router rebuild. This branch requires ^11.4 || ^12.
  • DomainDeleteForm::getCancelUrl() becomes redundant now that the collection relation resolves, since core's EntityDeleteFormTrait returns the collection URL by itself. Left alone as a separate, optional cleanup.

Merge request reports

Loading