Example #1
0
 /**
  * Register account (only used for customer module)
  * @param string $username
  * @param string $password
  * @param string $fullName
  * @param string $email
  * @param string $ssn
  * @param string $mobile
  * @return unknown
  */
 public function registerUserAccount($username, $password, $fullName, $email, $ssn, $mobile)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $db->beginTransaction();
     try {
         // first create customer
         $customerModel = new Customer_Model_Customer();
         $customerID = $customerModel->createCustomer($fullName, $email, $ssn, $mobile);
         // second create user
         $userID = $this->_createUser($username, $password, $customerID);
         // add customer role ID
         $roleModel = new Customer_Model_Role();
         $customerRoleID = $roleModel->getCustomerRoleID();
         // finally create roles for the user
         $this->_createRolesForUser($userID, array($customerRoleID));
         $db->commit();
         return $userID;
     } catch (Exception $e) {
         $db->rollBack();
         throw $e;
     }
 }
Example #2
0
 /**
  * Insert customer (helper)
  * @param string $name
  * @param string $email
  * @param string $ssn
  * @param string $mobile
  * @return int
  */
 private function _insertCustomer($name, $email, $ssn, $mobile)
 {
     $customerModel = new Customer_Model_Customer();
     return $customerModel->createCustomer($name, $email, $ssn, $mobile);
 }