Loading module-Controller from dynamic location

Hello there

I’m trying to use the controllerMap config param in order to overwrite for some customers the controllers. When I do this for the normal controllers it works fine, but as soon as it’s a module controller it’s not loading the custom one.

While debugging I see that first in CWebApplication->createController the $owner variable is set by CWebApplication, but in the next call it is set to the myCustomModule where the $owner->controllerMap is empty.

How can I make it to work also with modules?

Many thanks


If you use a controller from a module in the controllermap, the corresponding module will not be assigned.

So you have to override the constructor of the controller and assign the controllers module.

class ModuleController extends Controller 


        public function __construct($id,$module=null)




                 $module = Yii::app()->getModule('mymodule');