/** * Search user address data using userId or id. * * @access public * @param int $userId [user id] * @param int $id [addtress id] * @return string */ public function searchAddress($userId, $id) { $this->_errorStack = Noobh_ErrorStackSingleton::getInstance(); try { $addressModel = new Models_Address(); $result = $addressModel->getAddressBy($userId, $id); if (!empty($result)) { $addressInfo = array('address1' => $result->getAddress1(), 'address2' => $result->getAddress2(), 'country' => $result->getCountry(), 'zipCode' => $result->getZipCode(), 'mobileNumber' => $result->getMobileNumber(), 'phoneNumber' => $result->getHomeNumber()); return $addressInfo; } else { throw new Exception($this->_errorList[601], 601); } } catch (Exception $ex) { $code = $ex->getCode(); $message = $ex->getMessage(); $this->_errorStack->push(self::VALIDATION_TYPE, $code, $message); Noobh_Log::error($message); throw new Exception($message); } }
/** * Returns true if user exists for the email id or user id, * else it return false. * * @access private * @param string $email [Email address] * @param null $id [User Id] * @return bool */ private function _isExists($email, $id = null) { //Log info Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . 'Checks user exists for email : ' . $email); return $this->getUserBy($email, $id); }
/** * Checks if address exists for the user id, * else it returns false. * * @access private * @param null $userId [Models_User id] * @param null $id [Models_Address id] * @return bool */ private function _isExists($userId = null, $id = null) { //Log info Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . 'Checks user exists for userid : ' . $userId); return $this->getAddressBy($userId, $id); }