This time - a simple problem:

public function beforeValidate();

When making use of one of these great before(…) or after(…) hooks in the CActiveRecord, how can I differentiate between the "old" data in the DB and the "new" data trying to overwrite the old?

I’m looking for sth like:


 * Raise event informWebmaster if a user changed his email - JUST AS EXAMPLE


public function beforeValidate()


    if ($this->OLD->email !== $this->email) {

        $event = new CModelEvent($this);



    return parent::beforeValidate();


Yii does not handle this for you

I recommend storing the value of the attribute(s) in afterFind(), then in beforeValidate() you can compare the stored/old value(s) to the new value(s)