src/Cpm/JovenesBundle/Controller/PlantillaController.php
/**
     * Edits an existing Plantilla entity.
     *
     * @Route("/{id}/update", name="plantilla_update")
     * @Method("post")
     * @Template("CpmJovenesBundle:Plantilla:edit.html.twig")
     */
Edits an existing Plantilla entity.
Edits an existing Plantilla entity .
public function updateAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();
		$entity = $this->getEntityForUpdate('CpmJovenesBundle:Plantilla', $id, $em);
		$editForm   = $this->createForm(new PlantillaType(), $entity);
        $deleteForm = $this->createDeleteForm($id);
        $request = $this->getRequest();
        $editForm->bindRequest($request);
        $mailer = $this->getMailer();
        $parsed = 	$mailer->isValidTemplate($entity->getCuerpo());
        if ($editForm->isValid() && ($parsed == "success")) {
            $em->persist($entity);
            $em->flush();
            return $this->redirect($this->generateUrl('plantilla_edit', array('id' => $id)));
        }
        $retorno = array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
        if ($parsed != "success") 
        	$retorno['template_error'] = "Error en la plantilla ($parsed)";
        return $retorno;
    }
public function updateAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getEntityManager ( ) ; $ entity = $ this -> getEntityForUpdate ( 'CpmJovenesBundle:Plantilla' , $ id , $ em ) ; $ editForm = $ this -> createForm ( new PlantillaType ( ) , $ entity ) ; $ deleteForm = $ this -> createDeleteForm ( $ id ) ; $ request = $ this -> getRequest ( ) ; $ editForm -> bindRequest ( $ request ) ; $ mailer = $ this -> getMailer ( ) ; $ parsed = $ mailer -> isValidTemplate ( $ entity -> getCuerpo ( ) ) ; if ( $ editForm -> isValid ( ) && ( $ parsed == " success " ) ) { $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'plantilla_edit' , array ( 'id' => $ id ) ) ) ; } $ retorno = array ( 'entity' => $ entity , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; if ( $ parsed != " success " ) $ retorno [ 'template_error' ] = " Error en la plantilla ( $ parsed ) " ; return $ retorno ; }
Edits an existing Plantilla entity.
Edits an existing Plantilla entity .