Controller
Código PHP:
public function newAction()
{
$entity = new Users();
$form = $this->createForm(new UsersType(), $entity);
return array(
'entity' => $entity,
'form' => $form->createView()
);
}
/**
* Creates a form to create a Contact entity.
* @param Contact $entity The entity
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Contact $entity)
{
$form = $this->createForm(new ContactType($this->getDoctrine()->getManager()), $entity, array(
'action' => $this->generateUrl('admission_contact_applicant_save'),
'method' => 'POST', ));
$form->add('saveAndNew', 'submit', array('label' => 'saveAndNew', 'attr'=> array('id'=>'new', 'class'=>'btn-primary')));
$form->add('save', 'submit',array('label' => 'save', 'attr'=> array('id'=>'finish')));
//));
return $form;
}
En el save
Código PHP:
if ($form->get('saveAndNew')->isClicked()) {
return $this->redirect($this->generateUrl('ABCAdmission_applicant_resumen', array('id'=>$id)));
}
luego en el else el resto, pero no funciona, porque nose