Created
March 12, 2018 16:40
-
-
Save andrechavesg/9bd824b9d1271d26b8421c4254aa7ee0 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
/** | |
* @Route("/projeto/mostra/{id}") | |
*/ | |
public function mostraAction(Projeto $projeto) | |
{ | |
return $this->render('Projeto/mostra.html.twig',["projeto" => $projeto]); | |
} | |
/** | |
* @Route("/projeto/novo",methods="GET") | |
*/ | |
public function formulario() | |
{ | |
return $this->render("Projeto/novo.html.twig"); | |
} | |
/** | |
* @Route("/projeto/novo",methods="POST") | |
*/ | |
public function cria(Request $request) | |
{ | |
$nome = $request->get("nome"); | |
$projeto = new Projeto(); | |
$projeto->setNome($nome); | |
$em = $this->getDoctrine()->getManager(); | |
$em->persist($projeto); | |
$em->flush(); | |
return $this->redirect("/projeto/mostra/".$projeto->getNome()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment