Add actions to a controller

Hi, I have controllerA that has:




public function actions(){

return array(

'act1' => 'application.controllers.Dir.Act1Action',

'act2' => 'application.controllers.Dir.Act2Action',

);

}



and then I have controllerB extends controllerA. I want to add some actions to controllerB, without loosing controllerA’s actions.

If I do:




public function actions(){

return array(

'act3' => 'application.controllers.Dir.Act3Action',

'act4' => 'application.controllers.Dir.Act4Action',

);

}



Php returns: cannot redeclare controllerB::actions() in /path/to/controllerB. (sorry, my fault)

So, is there a way to inherit actions from parent controller and add other actions to controller child?

TIA

Danilo

OK, maybe I can solve adding public function actionAct3(){} to add other function. Anyway I would like to know if it is possibile to add actions in the way I’ve explained in first post :)

I guess you simply have to merge the 2 arrays. try:




public function actions()

{

   return CMap::mergeArray(parent::actions(), array(

      'act3' => 'application.controllers.Dir.Act3Action',

      'act4' => 'application.controllers.Dir.Act4Action',

   ));

}



Y!!++