Problem/Motivation
In #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name we added the ability to deprecate routes, but we later found that usages of RouteMatchInterface::getRouteName()
for checking against specific route name(s) are problematic because they can't take into account deprecated route names.
Proposed resolution
Add a method on \Drupal\Core\Routing\RouteMatchInterface
that can be used to compare the route name against a given string (or a list of them), and document that RouteMatchInterface::getRouteName()
is discouraged for this purpose. That method can't be deprecated because there are valid use-cases for retrieving the route name, e.g. the route
and route.name
cache contexts, getting local tasks or actions for the current route, etc.
Remaining tasks
Discuss, implement the new method, etc.
User interface changes
Nope.
Introduced terminology
N/A
API changes
API addition: a new method on \Drupal\Core\Routing\RouteMatchInterface
.
Data model changes
Nope.
Release notes snippet
TBD.