class User extends CActiveRecord { public function afterConstruct() { $this->created_at = time(); } }
class Message extends CActiveRecord { public function afterConstruct() { $this->status = 'new'; $this->read_count = 0; } }In this example, we set default values for the `status` and `read_count` properties of a Message object. The CActiveRecord class is included in the Yii Framework package library.