Event Question

I have a question regarding events: when you define an event (let’s name it onEventMethod()) and you attach to it some handlers, when raiseEvent method for this event is executed, the onEventMethod is never called by the framework (unless called explicitely by you) - the attached handlers are called instead. Am I right?

I am asking because I found such a piece of code in Yii Development Cookbook:

// defining onNewComment event

public function onNewComment($event) {

// Event is actually triggered here. This way we can use

// onNewComment method instead of raiseEvent.

$this->raiseEvent(‘onNewComment’, $event);


In case I am wrong, the above code would lead to the endless loop (and callstack overflow).

Or did I miss something…?

This link explains and the behaviours and events


Right, it does. I have read it before posting my question. And it still does not answer my question… :(