/** * soft deletes question definition * @param PollDefinition $pollDefinition * @param QuestionDefinition $questionDefinition * @return \Symfony\Component\HttpFoundation\RedirectResponse * @Route("/poll-definition/{pollDefinition}/question-definition/{$questionDefinition}/inactivate", name="questionDefinition_inactivate") * @Security("has_role('ROLE_EMPLOYER')") */ public function inactivateAction(PollDefinition $pollDefinition, QuestionDefinition $questionDefinition) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AkPollBundle:QuestionDefinition')->find($questionDefinition->getId()); $entity->setInactivated(true); $em->flush(); return $this->redirect($this->generateUrl('questionDefinition', array('pollDefinition' => $pollDefinition->getId()))); }
/** * edits an option definition * @param Request $request * @param QuestionDefinition $questionDefinition * @param $id * @return \Symfony\Component\HttpFoundation\RedirectResponse|Response * @Route("/question-definition/{questionDefinition}/option-definition/{id}/edit", name="optionDefinition_edit") * @Security("has_role('ROLE_EMPLOYER')") */ public function editAction(Request $request, QuestionDefinition $questionDefinition, $id) { $entity = new OptionDefinitionChoice(); $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository("AkPollBundle:optionDefinition")->find($id); $form = $this->createForm(new OptionDefinitionType(), $entity, array('method' => 'POST')); $form->add('submit', 'submit', array('label' => 'Update')); $form->handleRequest($request); if ($form->isValid()) { $em->flush(); return $this->redirect($this->generateUrl('optionDefinition_show', array('questionDefinition' => $questionDefinition->getId(), 'id' => $entity->getId()))); } return $this->render('optionDefinition/form.html.twig', array('form' => $form->createView())); }