Change the current active controller


Hello everybody,

Is there way to change the current active controller in Yii? When I tried to change the default SiteController with the one present in extensions using :

      Yii::app()->controller = 'application.extensions.employee.EmployeeController';


it throws the exception as :

    Property "CWebApplication.controller" is read only.

Any suggestions? Thanks! ::)


Could you explain why would you do so? What is your extension?

Hello Qiang,

I have already asked this question in other topic at:


Actually I want to create an extension which can interact with database and which can be used with any other views. I want to change the controller because the default 'SiteController' can not find the views which are present in the extension.