-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: [Auto Routing Improved] fallback to default controller's default method #7406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [Auto Routing Improved] fallback to default controller's default method #7406
Conversation
937cf28
to
18b3db1
Compare
df966fa
to
df04a9f
Compare
The default method is still accesible.
df04a9f
to
cc6b2d9
Compare
Cannot declare class CodeIgniter\Router\Controllers\Index
I would like to merge this. Can someone review? |
I think this autorouting is too auto. It seems to me that such a change will lead to incorrect operation of existing applications. If I compared on a scale of breaking changes, then I would rate this PR as 10 out of 10, and for example, changing the interface in the core of the framework 6 out of 10. |
If the There is no way to specify the type of a parameter like I do not think this PR (or #7162) to be a breaking change. |
I haven't looked at the Autorouter code because I think it's a waste of core team resources. Therefore, my comment was based only on the concept proposed in the PR. But after your answer, I saw that the code uses ReflectionClass. |
Defining all routes is tedious. |
Description
Related #7162
You can pass arguments to the default method of the default controller.
When you have
News\Home
andpublic function getIndex($id = null)
in it:GET /news/101
News
not foundNews\101
not found (invalid)News\101\Home
not found (invalid)News\Home
foundNews\Home::getIndex()
foundNews\Home::getIndex('101')
This PR makes it possible that one controller one URI.
Checklist: