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
Support controller in subdirectory #787
Comments
What's the use case for it? |
a self contained modules including frontend part and backend part |
We dropped the support for using subdirectories in controllers folder, as it is not commonly used, and when it is needed, you can use sub-modules to achieve similar effect. |
i think sub-modules and sub-directory is two different ways to classify controllers,and in most cases it's better than submodules , beacause it is more lightweight and simple. |
Yes, they're different things. One of the main reasons we dropped sub-directory of controllers support is for simplicity. For example, given a route Using subdirectory is a bit more lightweight, but not necessarily simpler, especially when you are also using modules. |
Complexity left to framework itself, Simplicity left to the users. |
I think both solutions are great. Personally I use subfolder instead of sub-module when a sub-module only has one controller and when I need two o more controllers I create a sub-module. If we could have both solutions would be amazing, |
I stopped using subfolders for my controllers when I got fet up with having to create URL rules just to make e.g. /admin work (where admin is the subfolder name). I think it is way cleaner to use modules, and it's just one small module folder and class file away. |
I would be very pleased if the docs reflected this lack of support, https://www.yiiframework.com/doc/guide/2.0/en/structure-controllers#controller-ids I have developed an application with lots of controllers under and admin subdir only to find that it is not supported and now I have to refactor everything to a module. /admin/user/update/1 won't work and you have to use /admin/user/update?id=1 Thanks! |
In 1.1,it support controller like:
/modules/yyy/controllers/xxxx/DefaultController.php
the route is r=yyy/xxx/default/index
it seems 2.0 doesn't support this
The text was updated successfully, but these errors were encountered: