- Assigned to larowlan
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 8:51am 19 January 2023 - Status changed to Needs work
almost 2 years ago 9:03am 19 January 2023 - Status changed to Needs review
almost 2 years ago 9:50am 19 January 2023 - 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland
I think every use of deprecated route should cause a warning
Sounds like a good idea.
- Status changed to Needs work
almost 2 years ago 11:59pm 30 January 2023 The Needs Review Queue Bot → tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to Needs review
almost 2 years ago 6:49am 31 January 2023 - 🇮🇳India pooja saraah Chennai
Fixed failed commands on #25
Attached patch against Drupal 10.1.x - Status changed to Needs work
almost 2 years ago 9:43am 31 January 2023 - 🇫🇷France andypost
Closed as duplicate 📌 Rename the 'alias' option for URLs Closed: duplicate and proper re-roll, leaving NW for tests
- 🇫🇷France andypost
All failed tests showing that deprecated route is used somehow, so it needs to clean-up usage
Moreover the error message is not clear enough - no route alias name is displayed (only in argument
dblog.delete
Exception: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'alias' in 'field list': INSERT INTO "test90401139router" ("name", "route", "alias") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => dblog.confirm [:db_insert_placeholder_1] => O:31:"Symfony\Component\Routing\Alias":2:{s:35:"Symfony\Component\Routing\Aliasid";s:12:"dblog.delete";s:44:"Symfony\Component\Routing\Aliasdeprecation";a:3:{s:7:"package";s:12:"drupal/dblog";s:7:"version";s:4:"10.1";s:7:"message";s:106:"The "%alias_id%" route alias is deprecated. You should stop using it, as it will be removed in the future.";}} [:db_insert_placeholder_2] => dblog.delete ) Drupal\Core\Routing\MatcherDumper->dump()() (Line: 164)
- 🇫🇷France andypost
Better to use route from #18
We could alias
user.well-known.change_password
->user.edit
as a working example of aliasing without deprecation. - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
This blocks:
- 📌 [PP-1] NodeRouteProvider should extend DefaultHtmlRouteProvider Needs work
- 📌 [PP-1] Use entity route providers for all content entity types Active
- 📌 [PP-1] Properly deprecate routes editor.image_dialog, editor.link_dialog and editor.media_dialog Postponed
… and probably more. So tagging .
- 🇬🇧United Kingdom joachim
The IS doesn't mention the plan that's in the title.
- 🇫🇷France andypost
-
+++ b/core/lib/Drupal/Core/Routing/MatcherDumper.php @@ -248,9 +264,17 @@ protected function schemaDefinition() { + 'alias' => [ ... 'indexes' => [ 'pattern_outline_parts' => ['pattern_outline', 'number_parts'], + 'alias' => ['alias'], +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -476,4 +487,30 @@ protected function getCurrentLanguageCacheIdPart() { + public function getRouteAliases(string $route_name): RouteCollection { ... + $routes = $this->connection->select($this->tableName, 'router') + ->fields('router', ['name']) + ->condition('alias', $route_name) ... + $select = $this->connection->select($this->tableName, 'router') + ->fields('router', ['alias']) + ->condition('name', $aliased_route_name); +++ b/core/modules/system/system.post_update.php @@ -51,3 +51,11 @@ function system_post_update_linkset_settings() { +function system_post_update_rebuild_matcher_dumper_with_alias_support(): void { + \Drupal::database()->schema()->dropTable('router');
new column and index - schema change should go to update hook I bet and rebuild probably will be automatic
also it needs upgrade test
-
+++ b/core/lib/Drupal/Core/Routing/RouteProviderInterface.php @@ -104,4 +105,29 @@ public function getAllRoutes(); + public function getRouteAliases(string $route_name): RouteCollection; ... + public function getUnAliasedRouteName(string $aliased_route_name): ?string;
the only API addition
-
- 🇮🇳India _utsavsharma
Patch for 11.x, as the previous was not failing to apply.
- last update
about 1 year ago 30,335 pass, 66 fail // Not using chunks because not many aliases expected. + $insert = $this->connection->insert($this->tableName)->fields([ + 'name', + 'route', + 'alias', + ]);
I'm coming here from https://www.drupal.org/project/drupal/issues/3311365 📌 Use PHP attributes for route discovery Needs review . It seems like this assumption might not hold necessarily?
+/** + * Rebuilds the router with alias support. + */ +function system_post_update_rebuild_matcher_dumper_with_alias_support(): void { + \Drupal::database()->schema()->dropTable('router'); + \Drupal::service('router.builder')->rebuild(); +}
Is this a case where it would be better to use
->setRebuildNeeded()
. Looking at what post update is doing, it does flush all caches afterwards, which would rebuild the router if needed.- 🇷🇴Romania amateescu
Fixed the feedback from #41 and #43.
Local tasks are not broken for an aliased route, so I removed the change from
LocalTaskManager
and the newgetUnAliasedRouteName()
which didn't have a purpose anymore.For aliasing
user.well-known.change_password
touser.edit
, after reading https://symfony.com/blog/new-in-symfony-5-4-route-aliasing I think that's not a valid example, because the two routes are not pointing to the same (URL) path.Wrote an upgrade path test, so we only need some test coverage for the new
RouteProvider::getRouteAliases()
method now.As for triggering deprecation errors for local tasks, I don't think that's necessary, the current
trigger_error()
fromRouteProvider::getRouteByName()
is enough IMO. And combined with 📌 Add option to log deprecation errors to prepare for Drupal 11 Needs work , it should provide enough visibility for deprecated routes. - 🇫🇷France andypost
Thank you! Still needs work to fix CS and
only need some test coverage for the new RouteProvider::getRouteAliases() method now.
- First commit to issue fork.
- 🇫🇷France andypost
and it shou8ld prove a test with deprecated route - let it be test module