Пример #1
0
 /**
  * @param int $id
  *
  * @return array|\Symfony\Component\HttpFoundation\RedirectResponse
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id)
 {
     $answer = $this->request->getPost()->get('answer');
     $time = $this->date->getCurrentDateTime();
     if ($this->pollRepository->pollExists($id, $time, is_array($answer)) === true) {
         if (!empty($answer) || is_array($answer) === true) {
             return $this->executePost($this->request->getPost()->all(), $time, $id);
         }
         $poll = $this->pollRepository->getOneById($id);
         return ['question' => $poll['title'], 'multiple' => $poll['multiple'], 'answers' => $this->answerRepository->getAnswersByPollId($id)];
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }