Modify Insert Query

i have created with gii the crud of db , I have a form to insert 10 field one field is user and one is date , i want insert this automatically (user is logged)how i can do this wich perts i must modify?

You can use hidden fields, you can use mysql to automaticly insert the time/date, you can modify beforeSave() to fit your needs, or you can do something like this:


   if($model->validate()) {

        $model->user= Yii::app()->user->id; //requiers you to redefine the id UserIdentity

        $model->date= timestamp();