本文整理汇总了PHP中BOL_UserService::saveOrUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP BOL_UserService::saveOrUpdate方法的具体用法?PHP BOL_UserService::saveOrUpdate怎么用?PHP BOL_UserService::saveOrUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOL_UserService
的用法示例。
在下文中一共展示了BOL_UserService::saveOrUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveQuestionsData
//.........这里部分代码省略.........
break;
case self::QUESTION_VALUE_TYPE_DATETIME:
$date = UTIL_DateTime::parseDate($data[$question->name], UTIL_DateTime::DEFAULT_DATE_FORMAT);
if (!isset($date)) {
$date = UTIL_DateTime::parseDate($data[$question->name], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
}
if (isset($date)) {
if (UTIL_Validator::isDateValid($date[UTIL_DateTime::PARSE_DATE_MONTH], $date[UTIL_DateTime::PARSE_DATE_DAY], $date[UTIL_DateTime::PARSE_DATE_YEAR])) {
$value = $date[UTIL_DateTime::PARSE_DATE_YEAR] . '-' . $date[UTIL_DateTime::PARSE_DATE_MONTH] . '-' . $date[UTIL_DateTime::PARSE_DATE_DAY];
if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
$property = new ReflectionProperty('BOL_User', $question->name);
$property->setValue($user, $value);
} else {
if (isset($questionsUserData[$question->name])) {
$questionData = $questionsUserData[$question->name];
} else {
$questionData = new BOL_QuestionData();
$questionData->userId = $userId;
$questionData->questionName = $question->name;
}
$questionData->dateValue = $value;
$questionDataArray[] = $questionData;
}
}
}
break;
case self::QUESTION_VALUE_TYPE_MULTISELECT:
if (!empty($data[$question->name]) && is_array($data[$question->name])) {
$value = array_sum($data[$question->name]);
}
case self::QUESTION_VALUE_TYPE_SELECT:
if (!isset($value)) {
$value = (int) $data[$question->name];
}
if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
$property = new ReflectionProperty('BOL_User', $question->name);
$property->setValue($user, $value);
} else {
if (isset($questionsUserData[$question->name])) {
$questionData = $questionsUserData[$question->name];
} else {
$questionData = new BOL_QuestionData();
$questionData->userId = $userId;
$questionData->questionName = $question->name;
}
$questionData->intValue = $value;
$questionDataArray[] = $questionData;
//$this->dataDao->save($questionData);
}
break;
case self::QUESTION_VALUE_TYPE_BOOLEAN:
$value = false;
$issetValues = array('1', 'true', 'on');
if (in_array(mb_strtolower((string) $data[$question->name]), $issetValues)) {
$value = true;
}
if ((int) $question->base === 1 && in_array($question->name, $dataFields)) {
$property = new ReflectionProperty('BOL_User', $question->name);
$property->setValue($user, $value);
} else {
if (isset($questionsUserData[$question->name])) {
$questionData = $questionsUserData[$question->name];
} else {
$questionData = new BOL_QuestionData();
$questionData->userId = $userId;
$questionData->questionName = $question->name;
}
$questionData->intValue = $value;
$questionDataArray[] = $questionData;
//$this->dataDao->save($questionData);
}
break;
}
}
}
$sendVerifyMail = false;
if ($user->id !== null) {
if (strtolower($user->email) !== strtolower($oldUserEmail)) {
$user->emailVerify = false;
$sendVerifyMail = true;
}
if (!empty($data['accountType'])) {
$accountType = $this->findAccountTypeByName($data['accountType']);
$accountTypeOld = $this->findAccountTypeByName($user->accountType);
if (!empty($accountType)) {
$user->accountType = $accountType->name;
$this->updateQuestionsEditStamp();
}
}
}
//printVar($user);
$this->userService->saveOrUpdate($user);
if (count($questionDataArray) > 0) {
$this->dataDao->batchReplace($questionDataArray);
}
if ($sendVerifyMail && OW::getConfig()->getValue('base', 'confirm_email')) {
BOL_EmailVerifyService::getInstance()->sendUserVerificationMail($user);
}
return true;
}