Esempio n. 1
0
 /**
  * @param array $formData
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData)
 {
     return $this->actionHelper->handleCreatePostAction(function () use($formData) {
         $this->pollsValidator->validate($formData);
         $formData['user_id'] = $this->user->getUserId();
         $pollId = $this->pollsModel->save($formData);
         $bool2 = false;
         if ($pollId !== false) {
             $bool2 = $this->pollsModel->saveAnswers($formData['answers'], $pollId);
         }
         return $pollId !== false && $bool2 !== false;
     });
 }
Esempio n. 2
0
 /**
  * @param array $formData
  * @param int $pollId
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData, $pollId)
 {
     return $this->actionHelper->handleEditPostAction(function () use($formData, $pollId) {
         $this->pollsValidator->validate($formData);
         $formData['user_id'] = $this->user->getUserId();
         $bool = $this->pollsModel->save($formData, $pollId);
         if (!empty($formData['reset'])) {
             $this->pollsModel->resetVotesByPollId($pollId);
         }
         $bool2 = $this->pollsModel->saveAnswers($formData['answers'], $pollId);
         return $bool !== false && $bool2 !== false;
     });
 }
Esempio n. 3
0
 /**
  * @param string $action
  *
  * @return array|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($action = '')
 {
     return $this->actionHelper->handleDeleteAction($action, function (array $items) {
         return $this->pollsModel->delete($items);
     });
 }