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