Exemplo n.º 1
0
 /**
  * Create user data.
  *
  * @access private
  * @param  void
  * @return bool
  */
 private function _insert()
 {
     try {
         $hashId = md5(self::SALT . $this->_email . date('YmdHis'));
         $bind = array($hashId, $this->_firstName, $this->_lastName, $this->_email, $this->_username, $this->_password);
         $sql = 'INSERT INTO `us_user` (`hash_id`, `first_name`,`last_name`,`email`,`username`,`password`,`created_on`,`updated_on`,`is_active`)' . 'VALUES (?,?,?,?,?,?,NOW(),NOW(),0)';
         $this->_dbAdapter->query($sql, $bind);
         //Log debug message
         Noobh_Log::debug(__CLASS__ . '::' . __FUNCTION__ . ', Sql Query - ' . $sql);
         $this->_id = $this->_dbAdapter->lastInsertId();
         $this->_hashId = $hashId;
         //Log info
         Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . '  - New user created with id : ' . $this->_id);
     } catch (Exception $ex) {
         $this->_errorStack->push(self::VALIDATION_TYPE, 913, $this->_errorList[913]);
         //Log fatal error
         Noobh_Log::fatal(__CLASS__ . '::' . __FUNCTION__ . ' User insert failed for email: ' . $this->_email . ' , Error code ' . $ex->getCode() . ' , Error Message ' . $ex->getMessage());
         throw $ex;
     }
 }
Exemplo n.º 2
0
 /**
  * Create user address.
  *
  * @access private
  * @param void
  * @return bool
  */
 private function _insert()
 {
     try {
         $bind = array($this->_userId, $this->_address1, $this->_address2, $this->_zipCode, $this->_country, $this->_mobileNumber, $this->_homeNumber);
         $sql = 'INSERT INTO `um_address` (`user_id`,`address1`,`address2`,`zip`,`country`,`mobile_phone`,`home_phone`,`created_on`,`updated_on`,`um_user_id`)' . 'VALUES (?,?,?,?,?,?,?,NOW(),NOW(),0)';
         $this->_dbAdapter->query($sql, $bind);
         //Log debug message
         Noobh_Log::debug(__CLASS__ . '::' . __FUNCTION__ . ', Completed executing Sql Query - ' . $sql);
         $this->_id = $this->_dbAdapter->lastInsertId();
         //Log info
         Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . '  - New user address created with id : ' . $this->_id);
     } catch (Exception $ex) {
         $this->_errorStack->push(self::VALIDATION_TYPE, 910, $this->_errorList[910]);
         //Log fatal error
         Noobh_Log::fatal(__CLASS__ . '::' . __FUNCTION__ . ' User insert failed for user id: ' . $this->_userId . ' , Error code ' . $ex->getCode() . ' , Error Message ' . $ex->getMessage());
     }
 }