Hello, first sorry about my English. I have several problems with updates of entity through Form. First, i want to know if i can make the insert and the update with the same action. For example, i have the action "empresa_details" if i pass the parameter 0(i dont know pass the parameter as null) it makes the insert, but if the parameter is an valid identifier it shows the info on the form, but when i submit the form he makes new entity. It is posible? The second problem is make only a update. I modified the code so I would not do the insert and I make an action to update and the action shows me the data, but if I modify the info and i click the save button, the info doesn't modify. This is my code in the action of the controller.
/** * @Route("/details/{pidEmpresa}", name="_empresa_details") * @Template() */ public function detailsAction($pidEmpresa){ $em = $this->get('doctrine.orm.entity_manager'); $empresa = new \Acme\DemoBundle\Entity\CliClientes(); $form = $this->get('form.factory')->create(new AddEmpresaForm(),$empresa); $request = $this->get('request'); $empresas = $em->getRepository('Acme\DemoBundle\Entity \CliClientes')->find($pidEmpresa); $form = $this->createForm(new AddEmpresaForm(), $empresas); if ($request->getMethod() == 'POST') { $form->bindRequest($request); if ($form->isValid()) { // perform some action, such as save the object to the database $em->flush(); return new RedirectResponse($this- >generateUrl('_empresa_list')); } } -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en