Dear All,
I've been following the book until I reach Chapter 5 Page 101:
# protected/models/Page.phpprotected function beforeValidate(){ if(empty($this->user_id)) { $this->user_id = Yii::app()->user->id; }
return parent::beforeValidate();}
The problem that I found when I try to create Page:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'user_id' at row 1. The SQL statement executed was: INSERT INTO `page` (`live`, `user_id`, `title`, `content`, `date_updated`, `date_published`) VALUES (:yp0, :yp1, :yp2, :yp3, NOW(), :yp4)
Is there something that I miss?
Regards,
Agus Kianto