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