@@ 92-98 (lines=7) @@ | ||
89 | $form = $this->createForm(\AppBundle\Form\SurveyType::class, $survey); |
|
90 | $form->handleRequest($request); |
|
91 | ||
92 | if ($form->isSubmitted() && $form->isValid()) { |
|
93 | $em = $this->getDoctrine()->getManager(); |
|
94 | $em->persist($survey); |
|
95 | $em->flush(); |
|
96 | ||
97 | return $this->redirectToRoute('surveys'); |
|
98 | } |
|
99 | ||
100 | return $this->render('@App/surveyform.html.twig', array( |
|
101 | 'form' => $form->createView(), |
|
@@ 127-133 (lines=7) @@ | ||
124 | $form = $this->createForm(\AppBundle\Form\SurveyType::class, $survey); |
|
125 | $form->handleRequest($request); |
|
126 | ||
127 | if ($form->isSubmitted() && $form->isValid()) { |
|
128 | $em = $this->getDoctrine()->getManager(); |
|
129 | $em->remove($survey); |
|
130 | $em->flush(); |
|
131 | ||
132 | return $this->redirectToRoute('surveys'); |
|
133 | } |
|
134 | ||
135 | return $this->render('@App/survey.html.twig', array( |
|
136 | 'form' => $form->createView(), 'survey' => $survey, 'question_answers' => $questionAnswer, |