src/Cpm/JovenesBundle/Controller/InstanciaEventoController.php
/**
     * Edits an existing InstanciaEvento entity.
     *
     * @Route("/{id}/update", name="instancia_update")
     * @Method("post")
     * @Template("CpmJovenesBundle:InstanciaEvento:edit.html.twig")
     */
Edits an existing InstanciaEvento entity.
Edits an existing InstanciaEvento entity .
public function updateAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();
		$entity = $this->getEntityForUpdate('CpmJovenesBundle:InstanciaEvento', $id, $em);
		$editForm   = $this->createForm(new InstanciaEventoType(), $entity);
        $deleteForm = $this->createDeleteForm($id);
        $request = $this->getRequest();
        $editForm->bindRequest($request);
        if ($editForm->isValid()) {
        	if ($editForm['preview']->getData()) {
            	$editForm['preview']->setData( false ); 
        	    return array(
		            		'entity' => $entity,
		            		'edit_form'   => $editForm->createView(),
				            'delete_form' => $deleteForm->createView(),		            		
		            		'preview_invitacion' => $this->getFakeEmail($entity)
		       		 		);
	      	}
            $em->persist($entity);
            $em->flush();
            $this->setSuccessMessage("Instancia de evento modificada satisfactoriamente");
            return $this->redirect($this->generateUrl('instancia_edit', array('id' => $id)));
        }
        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getEntityManager ( ) ; $ entity = $ this -> getEntityForUpdate ( 'CpmJovenesBundle:InstanciaEvento' , $ id , $ em ) ; $ editForm = $ this -> createForm ( new InstanciaEventoType ( ) , $ entity ) ; $ deleteForm = $ this -> createDeleteForm ( $ id ) ; $ request = $ this -> getRequest ( ) ; $ editForm -> bindRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { if ( $ editForm [ 'preview' ] -> getData ( ) ) { $ editForm [ 'preview' ] -> setData ( false ) ; return array ( 'entity' => $ entity , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , 'preview_invitacion' => $ this -> getFakeEmail ( $ entity ) ) ; } $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> setSuccessMessage ( " Instancia de evento modificada satisfactoriamente " ) ; return $ this -> redirect ( $ this -> generateUrl ( 'instancia_edit' , array ( 'id' => $ id ) ) ) ; } return array ( 'entity' => $ entity , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Edits an existing InstanciaEvento entity.
Edits an existing InstanciaEvento entity .