public function addAction(Request $request) { $extract = new Extract(); $extract->setAuthor($this->get('zz_pyro.profile_manager')->getProfile()); $form = $this->createForm('extract', $extract, ['action' => $this->generateUrl('zz_pyro_form_extract_add')]); if ($form->handleRequest($request)->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($extract); $em->flush(); return $this->render('ZzPyroBundle:Entity:confirm.html.twig'); } return $this->render('ZzPyroBundle:Entity:add.html.twig', ['form' => $form->createView()]); }
public function extractAction(Request $request, BestOf $bestof) { $extract = new Extract(); $extract->setAuthor($this->get('zz_pyro.profile_manager')->getProfile())->setBestOf($bestof); $path = $this->generateUrl('zz_pyro_form_bestof_extract', ['id' => $bestof->getId()]); $form = $this->createForm('bestof_extract', $extract, ['action' => $path]); if ($form->handleRequest($request)->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($extract); $em->flush(); return $this->render('ZzPyroBundle:Form:extract_confirm.html.twig', ['path' => $path]); } return $this->render('ZzPyroBundle:Form:form.html.twig', ['form' => $form->createView()]); }