Example #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;
     });
 }
Example #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;
     });
 }