Attaching action to controller...


maybe I missed the section in TFM, but, is there any way to attach an action to a controller, other than configuring it in the CController.actions()? This is my case: I have an extension, which will be used a lot. This extension needs an action to load data to a dropDownList using ajax. I created a CAction class inside my extension’s directory, then I configured it in the controller’s actions(), accessRules() and filters() methods. This works just fine, but it’s a bit prone to errors and, as I’m lazy, I’d like to attach the action like if it were a behavior… I don’t think this could possible at all, but who knows =)

Just a thought, inspired by the EUpdateDialog extension: Create your CAction classes as you already do and place them in your protected/actions directory. Then simply add an alias at your controller’s actions method. e.g.:


public function actions()


  return array(

    'create' => 'application.actions.CreateAction',