protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); if ($form->isValid()) { $peticion = $form->save(); $newCodigo = new Codigo(); $newCodigo->setIdUser($form->getObject()->getIdUser()); $newCodigo->setNumero($form->getObject()->getNumero() * -1); $newCodigo->setBarrio($form->getObject()->getBarrio()); $newCodigo->setCalle1($form->getObject()->getCalle1()); $newCodigo->setCalle2($form->getObject()->getCalle2()); $newCodigo->setNumCasa($form->getObject()->getNumCasa()); $newCodigo->setObservacion($form->getObject()->getObservacion()); try { $newCodigo->save(); $peticion->delete(); $this->redirect('codigo/editagregar?id=' . $newCodigo->getId()); } catch (Exception $e) { $this->redirect('peticionCodigo/edit?id=' . $peticion->getId()); } } }