Nested controller in a module


I want to create a Action Route like this:


Without modules, it is easy: I create the "controllers/path/to" path and put the MyController.php class file in there.

But this does not work when I am using modules. I tried to put the MyController.php class file in "modules/mymodule/controllers/path/to/", but this approach does not work.

How should I do that? Thank you.

I found my answer; both work the same way: You create a subfolder in controllers folder and place the controller file in it.

But for those who may get confused -like me: If you have a controller -AjaxController for example- and you have a folder named “ajax” beside it for any reason -storing relevant action classes for example- You CANNOT place any controller in that folder anymore. Yii simply won’t look into it for any existing controllers.