Event Example from Documentation

I was reading the documentation about Events and Behaviors. Very Interesting reading about Behaviors BTW. Still have to digest that. The comments have a “Real World Example” of an event. Basically an event is conditionally registered in the after save event, then a method is attached to the event, then the event is enabled in the controller. But why all the extra event handling? Couldn’t I just call my method in the afterSave method? What is the advantage to all the extra event handling code?

I wanted to ask this question in context, but I am too new to post comments there.

Here is the page I am referring to: http://www.yiiframework.com/wiki/44/behaviors-events

Bellowed URL MAy Help May More


After hours of reading I also don’t get it (yet)… why use events when in the end you still have to invoke them manually :blink: And so it seems more logically to call the method directly.

I think I just don’t get it… What did make YOU (reader) understand Events in Yii? All help is welcome.