예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 /**
  * @param string $emailAddress
  * @param int $salutation
  * @param string $firstName
  * @param string $lastName
  * @param string $hash
  *
  * @return bool|int
  */
 protected function addNewsletterAccount($emailAddress, $salutation, $firstName, $lastName, $hash)
 {
     $newsletterAccount = $this->accountRepository->getOneByEmail($emailAddress);
     if (!empty($newsletterAccount)) {
         $accountId = $this->updateExistingAccount($newsletterAccount, $salutation, $firstName, $lastName, $hash);
     } else {
         $accountId = $this->insertNewAccount($emailAddress, $salutation, $firstName, $lastName, $hash);
     }
     return $accountId;
 }