I'm using Yii framework and it seems something goes wrong when I use its MVC,
I have model called 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 failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1364 Field 'idmsg' doesn't have a default value. The SQL statement executed was: INSERT INTO sav
(reclamation
) VALUES (:yp0)
Here is my controller :
$reclamation = new Sav;
$reclamation->setId(88);
$reclamation->setIdmsg(11);
$reclamation->setReclamation("test");
$reclamation->save();