-
-
Save Narven/72173460541c8046d08a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try{ | |
$em = $this->getDoctrine()->getManager(); | |
$em->persist($entity); | |
$em->flush(); | |
$this->get('session')->setFlash('notice', 'Article inserted!'); | |
return $this->redirect($this->generateUrl('article_show', array('id' => $entity->getId()))); | |
}catch(\Exception $e){ | |
// log $e->getMessage() | |
$this->get('session')->setFlash('error', "Can't insert the article."); | |
} | |
return $this->render('MyTestBundle:Article:new.html.twig', array( | |
'entity' => $entity, | |
'form' => $form->createView(), | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment