当前位置: 首页>>代码示例>>PHP>>正文


PHP BOL_UserService::saveOrUpdate方法代码示例

本文整理汇总了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;
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:101,代码来源:question_service(19-5-2015).php


注:本文中的BOL_UserService::saveOrUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。