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


PHP BOL_UserService::replaceAccountTypeForUsers方法代码示例

本文整理汇总了PHP中BOL_UserService::replaceAccountTypeForUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP BOL_UserService::replaceAccountTypeForUsers方法的具体用法?PHP BOL_UserService::replaceAccountTypeForUsers怎么用?PHP BOL_UserService::replaceAccountTypeForUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BOL_UserService的用法示例。


在下文中一共展示了BOL_UserService::replaceAccountTypeForUsers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteAccountType

 public function deleteAccountType($accountType)
 {
     if (!isset($accountType)) {
         return false;
     }
     $accountTypeName = trim($accountType);
     $account = null;
     $repleaceToAccount = null;
     $prevKey = null;
     $accounts = $this->accountDao->findAll();
     if (count($accounts) <= 1) {
         return false;
     }
     foreach ($accounts as $key => $value) {
         if ($repleaceToAccount === null && $account !== null) {
             $repleaceToAccount = $accounts[$key];
         }
         if ($accountTypeName == $value->name) {
             $account = $value;
             if ($prevKey !== null) {
                 $repleaceToAccount = $accounts[$prevKey];
             }
         }
         $prevKey = $key;
     }
     if ($account === null) {
         return false;
     }
     $questions = $this->questionDao->findQuestionsForAccountType($account->name);
     $questionIdList = array();
     foreach ($questions as $key => $value) {
         $questionIdList[] = $value['id'];
     }
     $this->deleteQuestion($questionIdList);
     $this->userService->replaceAccountTypeForUsers($account->name, $repleaceToAccount->name);
     $key = BOL_LanguageService::getInstance()->findKey(self::QUESTION_LANG_PREFIX, $this->getQuestionLangKeyName(self::LANG_KEY_TYPE_ACCOUNT_TYPE, $account->name));
     if ($key !== null) {
         BOL_LanguageService::getInstance()->deleteKey($key->id);
     }
     $this->accountDao->deleteById($account->id);
     $this->updateQuestionsEditStamp();
     $deleted = (bool) OW::getDbo()->getAffectedRows();
     if ($deleted) {
         $event = new OW_Event(self::EVENT_ON_ACCOUNT_TYPE_DELETE, array('id' => $account->id, 'name' => $account->name));
         OW::getEventManager()->trigger($event);
     }
     return $deleted;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:48,代码来源:question_service.php


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