我正在使用Yii框架,当我使用它的MVC时似乎出了问题,
我有一个名为Sav的模型:
class Sav extends CActiveRecord{
private $id;
private $idmsg;
private $reclamation;
public function TableName(){
return 'sav';
}
public function primaryKey(){
return 'id';
}
public function getId() {
return $this->id;
}
public function getIdmsg() {
return $this->idmsg;
}
public function getReclamation() {
return $this->reclamation;
}
public function setId($id) {
$this->id=$id;
}
public function setIdmsg($idmsg) {
$this->idmsg=$idmsg;
}
public function setReclamation($reclamation) {
$this->reclamation=$reclamation;
}
}
CDbCommand无法执行SQL语句:SQLSTATE [HY000]:常规错误:1364字段'idmsg'没有默认值。执行的SQL语句是:INSERT INTO sav
(reclamation
)VALUES(:yp0)
这是我的控制器:
$reclamation = new Sav;
$reclamation->setId(88);
$reclamation->setIdmsg(11);
$reclamation->setReclamation("test");
$reclamation->save();