Problem/Motivation

In #3540386: [meta] Explore using more service closures to break deep dependency chains and load fewer services @berdir noticed a long dependency chain:

router_listener -> router -> router.no_access_checks -> url_generator -> renderer -> theme.manager -> theme.registry -> extension.list.module

Url generator in this one looked weird, so I checked, it's not used.

This has been the case since #3293284: Throw an exception when Router::generate() is called which is 'only' three years ago. We should be able to remove the dependency now.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#5 Screenshot 2025-08-08 134043.png92.85 KBberdir

Issue fork drupal-3540398

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review
berdir’s picture

Status: Needs review » Reviewed & tested by the community

This looks good, nice little cleanup.

berdir’s picture

StatusFileSize
new92.85 KB

Couldn't resist to try my debug file idea, it's a bit tricky to diff, there are also some seemingly unrelated changes that I'm seeing, I think the whole thing isn't quite stable yet, possibly due to caches warming up, so I did a git diff words, as a screenshot.

Essentially, the url_generator moves down to the maintenance mode subscriber. Which is likely another good target for some service locators, it has a ton of dependencies that only needed if maintenance mode is on.

This also shows the middleware issue that #3538294: Regression: All stack middlewares are constructed at the same time even for cached pages is working on quite nicely.

I'll share more of that and some example files later in #3540386: [meta] Explore using more service closures to break deep dependency chains and load fewer services.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4748574 and pushed to 11.x. Thanks!

  • alexpott committed 47485748 on 11.x
    Issue #3540398 by catch: Remove Url generator from router class
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.