Component And Events

I am looking to build a component that has listeners. So in the component I have an init method that adds events to specific methods based on which controller action is triggered. So for example when I hit controller A action A because I have those listeners up a part of my component fires off and does something I specified. Same goes for other controllers if in init in the component I told it to have an event for that action / method. Does that make sense?




class MyComponent extends Component {

    public function init() {

        // Initialize events for the controller and this components method A and so forth

        // Example: create listener for controller::actionA to do methodA when actionA is hit

    }


    public function methodA() {

        // Do something here when the controller action triggers the event

    }

}



Is this possible in Yii?

Answer: NO! (From my findings, controllers are NOT initialized before Preload)