/**
  * lists all Poll entities.
  * @param PollDefinition $pollDefinition
  * @return Response
  * @throws \Exception
  * @throws \Twig_Error
  * @Route("/poll/{pollDefinition}", name="poll")
  * @Security("has_role('ROLE_EMPLOYER') or has_role('ROLE_POLLSTER')")
  */
 public function indexAction(PollDefinition $pollDefinition)
 {
     $entities = $pollDefinition->getPolls();
     $html = $this->container->get('templating')->render('poll/index.html.twig', ['pollList' => $entities, 'pollDefinition' => $pollDefinition]);
     return new Response($html);
 }
 /**
  * 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())));
 }
 /**
  * @param PollDefinition $pollDefinition
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getQuestionDefinitions(PollDefinition $pollDefinition)
 {
     return $pollDefinition->getQuestionsDefinitions();
 }