While creating a new Event in YII, why do we pass "THIS" object in the constructor ?
for ex, this is an example from YII Cookbook where comment event is being added to POST -
$event = new NewCommentEvent($this);
Thanks
While creating a new Event in YII, why do we pass "THIS" object in the constructor ?
for ex, this is an example from YII Cookbook where comment event is being added to POST -
$event = new NewCommentEvent($this);
Thanks
Check the class manual:
http://www.yiiframework.com/doc/api/1.1/CEvent#__construct-detail
Each event provides the sender (the object which initiated the event) in $event->sender. Therefore you have to supply the sending object to the constructor.