/** * @param array $formData * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ protected function executePost(array $formData) { return $this->actionHelper->handlePostAction(function () use($formData) { $this->unsubscribeFormValidation->validate($formData); $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_DISABLED, ['mail' => $formData['mail']]); $this->setTemplate($this->get('core.helpers.alerts')->confirmBox($this->translator->t('newsletter', $bool !== false ? 'unsubscribe_success' : 'unsubscribe_error'), $this->appPath->getWebRoot())); }); }
/** * @param string $hash */ public function execute($hash) { try { $this->activateAccountFormValidation->validate(['hash' => $hash]); $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_CONFIRMED, ['hash' => $hash]); $this->setTemplate($this->get('core.helpers.alerts')->confirmBox($this->translator->t('newsletter', $bool !== false ? 'activate_success' : 'activate_error'), $this->appPath->getWebRoot())); } catch (Core\Validation\Exceptions\ValidationFailedException $e) { $this->setContent($this->get('core.helpers.alerts')->errorBox($e->getMessage())); } }
/** * @param string $action * * @return mixed * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($action = '') { return $this->actionHelper->handleDeleteAction($action, function (array $items) { $bool = false; foreach ($items as $item) { $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_DISABLED, $item); } return $bool; }); }
/** * @param int $id * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function execute($id) { $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_CONFIRMED, $id); return $this->redirectMessages()->setMessage($bool, $this->translator->t('newsletter', $bool !== false ? 'activate_success' : 'activate_error')); }