Integrity constraint violation: 1062 Duplicate entry '2' for key 1 in symfony doctrine using form widgets
I can't update the form usinf formwidgets, I'm using doctrine and symfony 1.4.
Here is my code
protected function processFormUpdate(sfWebRequest $request, sfForm $form){
$form->bind($request->getParameter('tblallusers'),$request->
getFiles($form->getName()));
if ($form->isValid()) {
$logement = $form->save();
}
else {
$this->getUser()->setFlash('error', 'error');
}
}
public function executeEdit(sfWebRequest $request)
{
echo $id = $this->getRequestParameter('id');
$object = Doctrine_Core::getTable("Tblallusers")->find($id);
$this->form = new TblallusersForm($object);
}
public function executeUpdate(sfWebRequest $request)
{
echo $id = $this->getRequestParameter('id');
$object = Doctrine_Core::getTable("Tblallusers")->find($id);
$this->form = new TblallusersForm($object);
$this->processFormUpdat开发者_高级运维e($request, $this->form);
}
The above code throws an error like
Integrity constraint violation: 1062 Duplicate entry '2' for key 1
Please help me out of this......
The id should be grater than zero and should be unique
精彩评论