Controller and behavior

Is there a possibility to attach a behavior to a controller class? In the documentation I found a "attachbehavior" method, but don't know, when this is called?

I want to attach a behavior (class) to some of my controllers, where in the "beforeAction" method are handled some processes. I don't want to create a BaseController which will be extended by my controllers, because of reuseability.

Could you please create a ticket for this? Right now, behaviors are not attached by default, even though attachbehavior() method exists.

Ok, done :slight_smile:

I also need CControllerbehavior. This could help to implement single class to attach Captcha to a controller with a single line of code!

You should be able to attach a behavior in your init() method with attachbehavior().