Problem/Motivation
Since #3311365: Use PHP attributes for route discovery has introduced route definitions via PHP attributes, this means route discovery iterates through and reflects all files/classes in the Controller namespace/directory of modules. Removing files and classes that are not controllers from these folders can improve the speed and memory usage of the discovery.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Comments
Comment #2
mstrelan commentedShould we also move controllers not in a Controller namespace? These can't use Route attributes. I found 175 instances in tests and 21 outside of tests.
Runtime:
grep -rn '_controller:' core --include="*.routing.yml" | grep -v '\\Drupal\\[a-zA-Z_]*\\Controller\\' | grep -v testsTests:
grep -rn '_controller:' core --include="*.routing.yml" | grep -v '\\Drupal\\[a-zA-Z_]*\\Controller\\' | grep testsResults attached.
Comment #3
aaronmchaleI think it would be really good to establish a convention here, it's so often the case that the src directory of a module looks a bit messy.
Comment #4
catch#3490484: [meta] Lots of non-plugin PHP classes in plugin directories is very closely related and if we use moved_classes for both there could potentially be a lot of conflicts.
Maybe we could combine the scope? So move non-plugin and non-controller classes per group of modules at the same time?
Comment #5
godotislate#4 sounds good. Offhand it seems like most of the work would be agreeing on a plan on where to move what types of files.
There is the instanceof issue using moved_classes/class aliases, but that can be discussed there as well.
Comment #6
godotislateRe #2: I think it makes sense to open another issue to see which (non-form) controllers that aren't in the Controller namespace we want to move so that we can convert those routes to attributes.
Comment #7
mstrelan commentedOpened #3585072: Move controller classes to Controller namespaces for #2 / #6.