Controller instantiation in Yii framework by directory and namespace
- by Einoras Bružas
Yii framework supports modules and also subdirectories in controllers directory, so path to some specific action could be /index.php?r=module/controller/action or /index.php?r=subdirectoryInControllerDir/controller/action. My goal here is to have multiple subdirectories in controllers dir. Inside these folders I would create Controllers with the same names as parent ones using namespaces. However if I wrote
namespace mynamespace;
class MyController extends \MyController {
}
Yii would load MyController instead of mynamespace\MyController;
Any suggestions here?