You must unset the key field in the emebeded form, have a look:

http://www.symfony-project.org/blog/2008/11/12/call-the-expert-customizing-sfdoctrineguardplugin



On 6/27/09, greg <[email protected]> wrote:
>
> Hello.
> I have one table Question and one table Reponse(=answer) with relation
> 1-N.
>
> In the admin generator i make embed form on the page Question like
> this :
>
> class QuestionForm extends BaseQuestionForm
> {
>   public function configure()
>   {
>       $reponse = new Reponse();
>       $reponse->setQuestion($this->object);
>       $this->embedForm('reponse', new ReponseForm($reponse));
>
>   }
> }
>
> For add object, it works.
>
> But for modify object i add this code on my action.class.php :
>
>   public function executeEdit(sfWebRequest $request)
>   {
>     $this->question = $this->getRoute()->getObject();
>     $this->form = $this->configuration->getForm($this->question);
>
>
>       $reponse = $this->question->getOneReponse(0);
>       $reponse->setQuestion($this->object);
>       $this->form->embedForm('reponse', new ReponseForm($reponse));
>
>
>   }
>
> But when i click on Update i have this error :
>
> SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
> '18' for key 'PRIMARY'
>
>
> What can i do to fix thix problem??
>
> Thank's you!!!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to