Problem/Motivation
Following #2917331: Decouple from Symfony CMF we can simplify the implementation of, and reduce the API surface of, methods in UrlGenerator that accept both a route name and route object.
Examples:
UrlGenerator::getPathFromRoute()
UrlGenerator::generateFromRoute()
(also supporting protected methods)
In Drupal 10, this would also allow us to string typehint for those methods too.
Proposed resolution
Trigger a deprecation message when a route object is passed in.
Remaining tasks
While there's not a strict dependency in either direction, this issue is closely linked to #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage().
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | 3151019-31.patch | 5.75 KB | andypost |
| #31 | interdiff.txt | 4.19 KB | andypost |
Comments
Comment #2
catchComment #3
catchComment #4
andypostComment #5
catchNeeds deprecation testing adding, but also want to see if any existing test coverage fails first.
Comment #6
catchComment #8
catchBacktraces on the test failures aren't helpful, let's try this.
Comment #10
catchComment pager is passing in the route object, this should fix at least some of the test failures.
Comment #12
catchconfig_translation is relying on ::setRedirect() accepting a route object implictly.
Comment #13
catchWith deprecation testing now.
Comment #14
catchComment #15
andypostit needs @see to CR and explanation with replacement, or may use follow-up
Comment #16
catchWe should remove the ::supports and ::getRouteDebugMessage() hunks from this patch and do them in #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage().
Comment #17
catchComment #18
andypostThis method overriden only once in
\Drupal\Core\Routing\NullGenerator::getRoute()and implementation sounds for legacy support, could use follow-up to clean-up for d10not sure this change needed, as there's 2 more classes now implements this methods and have broken "inheritdoc" there too, see #3151017-10: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage()
-
\Drupal\Core\Render\MetadataBubblingUrlGenerator::supports-
\Drupal\help_test\SupernovaGenerator::supportsComment #20
wim leers+100 for this per #2491981: There are too many ways to generate URLs and links!
Can we still land this? 🤞🤓
Comment #21
andypostreroll for 9.2
Comment #26
needs-review-queue-bot commentedThe 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.
Comment #27
catch#3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage() is RTBC except for a re-roll, might be worth waiting on that just to avoid any potential conflicts.
I think this patch is in good shape except we need to update the deprecation messages to drupal:10.1.0 for removal in drupal:11.0.0.
Comment #28
andypostre-roll for 10.1 and there's only context conflict with #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage() so better to commit it
this 2 places anyway needs fix
Comment #29
andypostIt needs follow-up to remove deprecated methods in D11 and new method
UrlGenerator::getRouteStringIdentifier()added in related issue #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage()Comment #30
andypostFiled follow-up #3339710: Disallow passing route objects to UrlGenerator methods and waiting for #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage()
Comment #31
andypostblocker commited, here's re-roll and polishing of test and place to throw deprecation
Comment #32
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. 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.
Comment #33
nod_Umm, issue with the bot
Comment #34
andypostSomehow re-testing aborted, queued PHP 8.2 meantime but curious if there's some performance regression happened
Comment #35
andyposttests are passed, I see no difference in time - the same 1h for run
Comment #36
smustgrave commentedDeprecation message is up to date,
Change record is simple and clear.
Has test coverage for deprecation.
Code looks good to me.
Comment #38
longwaveCommitted to 10.1.x, thanks!