如何在 YII 中向 db 插入值时在所有控制器上添加完整性约束检查?最简单的方法是什么?
if($model->save())
$this->redirect(array('view','id'=>$model->id));
异常出现在这里
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '9-5' for key 'xyz'. The SQL statement executed was: INSERT INTO `tbl_table` (`xyz`, `x`, `x`, `x`, `x`, `x`, `x`, `created`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, NOW())