/** * @param array $id * * @return int */ protected function retrieveAccountId(array $id) { switch (key($id)) { case 'mail': $account = $this->accountRepository->getOneByEmail($id['mail']); break; case 'hash': $account = $this->accountRepository->getOneByHash($id['hash']); } return !empty($account) ? $account['id'] : 0; }
/** * @param int $id * * @return \Symfony\Component\HttpFoundation\RedirectResponse * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id) { if ($this->newsletterRepository->newsletterExists($id) === true) { $accounts = $this->accountRepository->getAllActiveAccounts(); $cAccounts = count($accounts); $recipients = []; for ($i = 0; $i < $cAccounts; ++$i) { $recipients[] = $accounts[$i]['mail']; } $bool = $this->newsletterHelpers->sendNewsletter($id, $recipients); $bool2 = false; if ($bool === true) { $bool2 = $this->newsletterRepository->update(['status' => '1'], $id); } return $this->redirectMessages()->setMessage($bool === true && $bool2 !== false, $this->translator->t('newsletter', $bool === true && $bool2 !== false ? 'create_success' : 'create_save_error')); } throw new Core\Controller\Exception\ResultNotExistsException(); }
/** * @param string $emailAddress * @param int $salutation * @param string $firstName * @param string $lastName * @param string $hash * * @return bool|int */ protected function insertNewAccount($emailAddress, $salutation, $firstName, $lastName, $hash) { $insertValues = ['id' => '', 'mail' => $emailAddress, 'salutation' => $salutation, 'first_name' => $firstName, 'last_name' => $lastName, 'hash' => $hash, 'status' => AccountStatus::ACCOUNT_STATUS_CONFIRMATION_NEEDED]; return $this->accountRepository->insert($insertValues); }
/** * @param string $data * @return bool */ protected function checkAccountExists($data) { return $this->accountRepository->accountExists($data); }