Extending Controller

I am using modules in my dev app, and what i need is to extend the main Controller class into 2 subclasses:

MyPublicController and MyAdminController.

Each of my module has an AdminController controller which handles the administration part of the module and one or more public controllers that can be accessed by anyone depending on their permissions. The AdminController controller from a module will always extend MyAdminController and the public controllers will always extend MyPublicController. The reason that i want to do it this way, is because once MyAdminController will handle the administrative part of my website, it will use another theme than the one used by the MyPublicController and beside this, i would like to keep separate the administrative panel with everything it implies by the rest of the website.

So, how and where can i add those two controllers so that they inherit every action from Controller class and their child classes can inherit those methods too .

Please keep in mind that i am using distinct themes for "backend" and "frontend" and the MyPublicController/MyAdminController needs to set them, and every controller that extends them, inherit those themes too .

I tried to do this by my own, put putting something like :




class Controller extends CController

{

/**

[...]

**/

public function __construct()

{

  parent::__construct();

}



Results in a




Missing argument 1 for CController::__construct(), called in C:\wamp\www\yii\cms\protected\components\Controller.php on line 30 and defined



But in this case, i cannot figure out which is the first argument that needs to be passed.

Also, i know that there’s the init() option to do things right before the controller class is instantiated, but i would like to use the __construct way because it feels better .

Please let me know of any answers you may have or if you have other Yii solutions that can help me accomplish what i want.

You don’t really need to override __construct but just in case you still want to do so:




class MyController extends CController {

  function __construct(){

    parent::__construct($this->id, $this->module);

  }

}



Oh, it makes sense this way.

Thank you for your answer.