Changed attribute not in $changedAttributes

I don’t understand where there can be a mistake




class User extends ActiveRecord {

    public $role; // this field is not in the users table


    public function afterFind()

    {

        $this->role = '...'; // I get a value from another table (from auth_assignment)

    }


    public function afterSave($insert, $changedAttributes)

    {

         var_dump($this->isAttributeChanged('role')); // return false;

         var_dump($this->isAttributeChanged('role', false)); // return false;

         var_dump($changedAttributes); // in this array there is no my changed attribute

    }

}



Docs says:

$changedAttributes - The old values of attributes that had changed and were saved.

Also tell me, if save works in fact? Database is changed? Particulary this value that u need to catch.