Problem/Motivation
Split from #3584823: Convert system module routes to use attributes
These were split because they are more complex and harder to test that the first batch.
- TimeZoneController
- BatchController
- EntityAutocompleteController
- CsrfTokenController
These were postponed on #3585072: Move controller classes to Controller namespaces but have been moved here:
- CronController - not in Controller namespace
- FileDownloadController - not in Controller namespace
Also wondering if now that we don't need a routing.yml file it is possible to move some of these out of system module. For example, EntityAutocompleteController could move to the Drupal\Core\Entity\Controller namespace.
Steps to reproduce
Proposed resolution
- Move
CronControllerandFileDownloadControllerto theDrupal\system\Controllernamespace - Add stubs to deprecate these classes. This is preferred over
moved_classesfor easier contrib compatibility. - Convert routing yaml definitions to PHP attributes
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3585079
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
Comment #2
mstrelan commented#3584823: Convert system module routes to use attributes is in. We can wait for #3585072: Move controller classes to Controller namespaces or we can possibly move the two affected classes in this issue. Or we can split this again and work on the 4 remaining classes that are in the correct namespace.
Comment #4
mstrelan commentedWill need a CR for the moved classes, the rest can be reviewed.
Comment #5
mstrelan commentedUnfortunately moved_classes doesn't seem to work as advertised.
Comment #6
mstrelan commentedSwapped to stubs instead of
moved_classes, it's much easier for contrib to deal with and support multiple versions.Comment #7
nicxvan commentedWhat exactly doesn't work?
Comment #8
mstrelan commented@nicxvan it still causes phpstan to fail. But now on reflection, that's by design. But handling multiple versions in contrib is still painful due to mismatched phpstan errors, so I don't think it's worth it..
Comment #9
smustgrave commentedLeft small comments on the MR but looks good! Honestly @mstrelan if you make those small changes you're probably good to self RTBC.
Comment #10
mstrelan commentedComment #11
godotislateI didn't find an issue to convert the system module
_formroutes to attributes. so maybe they could be done here if there isn't one. OTOH there might be too many form entries in system.routing.yml and make the scope too big, so creating another issue is fine too.This is a great idea. Discovery loops through the container namespaces, which include these in
Drupal\Core:I tested moving EntityAutocompleteController to Drupal\Core\Entity\Controller locally, and it seems to work correctly. I'm not sure if we should do that in this issue though, because maybe we'd want to move and update some corresponding tests as well. We can probably do a separate issue to evaluate what routes in system should be moved to Core and where.
One more thing is that we may want to wait for #3607968: Promote defaults._title to top level in route attributes so we use the Drupal Route attribute consistently.
Comment #12
mstrelan commented#3608572: Convert system module form routes to use attributes
Comment #13
mstrelan commentedOpened #3615108: Move _title and _title_callback out of defaults section in existing route attributes and #3615109: Consider moving some routes and controllers out of system module so we don't need to hold this one up.
Comment #14
larowlanWill we move Cron and FileDownload into a core namespace in #3615109: Consider moving some routes and controllers out of system module - in which case should we have a further deprecation? Should we try to put things in their final place instead?
Comment #15
mstrelan commented#14 that's a good point. I'm not sure how quickly #3615109: Consider moving some routes and controllers out of system module will move. Maybe we leave those two classes out of this issue?
Comment #16
godotislateAgreed, let's skip Cron and FileDownload controllers here and address in #3615109: Consider moving some routes and controllers out of system module.
Comment #17
godotislateNW for #14-16.