Hi,
I am having too much confusion with Events, behaviors and Event handlers.
Using this comment I got an understanding about it.
In that comment to execute an event, in User model class, afterSave() method is used.
User.php (Model):
class User extends CActiveRecord
{
// some other methods
public function afterSave()
{
if ($this->isNewRecord)
{
if ($this->hasEventHandler('onNewUser'))
{
$event = new CModelEvent($this);
$this->onNewUser($event);
}
}
parent::afterSave();
}
public function onNewUser($event)
{
$this->raiseEvent('onNewUser', $event);
}
}
I have a different scenario, in which after a successful transaction I want to send an email to the user.
Could anyone please tell me or give any advice on, how can I process the afterSave() method in my case.
Thanks