Controller instantiation in Yii framework by directory and namespace

Posted by Einoras Bružas on Programmers See other posts from Programmers or by Einoras Bružas
Published on 2011-01-05T15:04:53Z Indexed on 2011/01/05 15:59 UTC
Read the original article Hit count: 252

Filed under:
|
|

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?

© Programmers or respective owner

Related posts about php

Related posts about frameworks