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


PHP QueryBuilder::set方法代码示例

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


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

示例1: closeSession

 public function closeSession(ChatSession $session, ChatUser $closerUser, $reason = null)
 {
     $qb = new QueryBuilder();
     $qb->update(Tbl::get('TBL_CHAT_SESSIONS'))->set(new Field('closed'), static::CLOSED_STATUS_YES)->set(new Field('closed_date'), new Func('NOW'))->set(new Field('closed_by'), $closerUser->userId)->where($qb->expr()->equal(new Field('id'), $session->id));
     if ($reason !== null) {
         $qb->set(new Field('closed_reason'), $reason);
         $session->closedReason = $reason;
     }
     $this->query->exec($qb->getSQL());
     $session->closed = static::CLOSED_STATUS_YES;
     $session->closedBy = $closerUser->userId;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:12,代码来源:ChatSessionManager.class.php

示例2: updateConfigValue

 /**
  * Update DB Config
  * @param ConfigDB $oldDBCOnfig
  * @param ConfigDB $newDBConfig
  * @throws InvalidArgumentException
  */
 public static function updateConfigValue(ConfigDB $oldDBCOnfig, ConfigDB $newDBConfig)
 {
     if (empty($oldDBCOnfig) || empty($newDBConfig)) {
         throw new InvalidArgumentException("new or old DB config object is empty");
     }
     if (!isset($oldDBCOnfig->location) or empty($oldDBCOnfig->location)) {
         throw new InvalidArgumentException("odl Location of config should be non empty array");
     }
     if (!isset($newDBConfig->location) or empty($newDBConfig->location)) {
         throw new InvalidArgumentException("New Location of config should be non empty array");
     }
     if (!isset($oldDBCOnfig->name) or empty($oldDBCOnfig->name)) {
         throw new InvalidArgumentException("Old Name of config should be specified");
     }
     if (!isset($newDBConfig->name) or empty($newDBConfig->name)) {
         throw new InvalidArgumentException("New Name of config should be specified");
     }
     if (!isset($newDBConfig->value)) {
         throw new InvalidArgumentException("Value of new config should be specified");
     }
     $odlHostLangid = null;
     if (!empty($oldDBCOnfig->host) && !empty($oldDBCOnfig->language)) {
         $odlHostLangid = HostLanguageManager::getHostLanguageId($oldDBCOnfig->host, $oldDBCOnfig->language);
     }
     $newHostLangId = null;
     if (!empty($newDBConfig->host) && !empty($newDBConfig->language)) {
         $newHostLangId = HostLanguageManager::getHostLanguageId($newDBConfig->host, $newDBConfig->language);
     }
     $sql = MySqlDbManager::getQueryObject();
     $qb = new QueryBuilder();
     $qb->update(Tbl::get("TBL_CONFIGS"))->set(new Field("location"), implode(":", $newDBConfig->location))->set(new Field("name"), $newDBConfig->name)->set(new Field("value"), $newDBConfig->value)->where($qb->expr()->equal(new Field("location"), implode(":", $oldDBCOnfig->location)))->andWhere($qb->expr()->equal(new Field("name"), $oldDBCOnfig->name));
     if ($newHostLangId !== null) {
         $qb->set(new Field("host_lang_id"), $newHostLangId);
     } else {
         $qb->set(new Field("host_lang_id"), new Literal("null"));
     }
     if ($odlHostLangid !== null) {
         $qb->andWhere($qb->expr()->equal(new Field("host_lang_id"), $odlHostLangid));
     } else {
         $qb->andWhere($qb->expr()->isNull(new Field("host_lang_id")));
     }
     $sql->exec($qb->getSQL());
 }
开发者ID:Welvin,项目名称:stingle,代码行数:49,代码来源:ConfigDBManager.class.php

示例3: editOptionById

 /**
  * Edit an already created answer option
  *
  * @param integer $profile_id
  * @param string $new_answer
  * @param integer $sort_id
  */
 public function editOptionById($profile_id, $new_answer, $sort_id = null)
 {
     $additional_sql = '';
     $qb = new QueryBuilder();
     $qb->update(Tbl::get('TBL_PROFILE_KEYS'))->set(new Field('value'), $new_answer);
     if (empty($profile_id) or !is_numeric($profile_id)) {
         throw new InvalidArgumentException("\$profile have to be numeric id of the profile");
     }
     if (empty($new_answer)) {
         throw new InvalidArgumentException("\$new_answer have be not null string");
     }
     if (!empty($sort_id) and !is_numeric($sort_id)) {
         throw new InvalidArgumentException("\$sort_id have to have numeric value");
     } else {
         $qb->set(new Field('sort_id'), $sort_id);
         $additional_sql .= ", `sort_id`='{$sort_id}'";
     }
     $qb->where($qb->expr()->equal(new Field('id'), $profile_id));
     $this->query->exec($qb->getSQL());
 }
开发者ID:Welvin,项目名称:stingle,代码行数:27,代码来源:Profile.class.php

示例4: changeConversationMessageDeletedStatus

 /**
  * Change Conversation message deleted status.
  * 
  * Example:
  * 
  * Id1 sends message to Id2
  * Message is not deleted by anyone 	-> deleted = 0
  * Message deleted only by Id1 			-> deleted = Id2
  * Message deleted only by Id2			-> deleted = Id1
  * Message deleted by both				-> deleted = -1
  * 
  * @param integer $conversationMessageId
  * @param integer $myUserId
  * @param integer $status
  * @throws InvalidIntegerArgumentException
  */
 public function changeConversationMessageDeletedStatus($conversationMessageId, $myUserId, $status)
 {
     if (empty($conversationMessageId) or !is_numeric($conversationMessageId)) {
         throw new InvalidIntegerArgumentException("\$conversationMessageId have to be non zero integer.");
     }
     if (!is_numeric($status) or !in_array($status, self::getConstsArray("STATUS_DELETED"))) {
         throw new InvalidIntegerArgumentException("Invalid \$status specified.");
     }
     if (empty($myUserId) or !is_numeric($myUserId)) {
         throw new InvalidIntegerArgumentException("\$myUserId have to be non zero integer.");
     }
     // Get message
     $filter = new ConversationMessagesFilter();
     $filter->setId($conversationMessageId);
     $message = $this->getConversationMessage($filter, true);
     $interlocutorId = null;
     if ($message->senderId == $myUserId) {
         $interlocutorId = $message->receiverId;
     } else {
         $interlocutorId = $message->senderId;
     }
     $finalDeletedStatus = null;
     switch ($status) {
         case self::STATUS_DELETED_YES:
             switch ($message->deleted) {
                 case 0:
                     $finalDeletedStatus = $interlocutorId;
                     break;
                 case -1:
                     $finalDeletedStatus = -1;
                     break;
                 case $myUserId:
                     $finalDeletedStatus = -1;
                     break;
                 case $interlocutorId:
                     $finalDeletedStatus = $interlocutorId;
                     break;
             }
             break;
         case self::STATUS_DELETED_NO:
             switch ($message->deleted) {
                 case 0:
                     $finalDeletedStatus = 0;
                     break;
                 case -1:
                     $finalDeletedStatus = $myUserId;
                     break;
                 case $myUserId:
                     $finalDeletedStatus = $myUserId;
                     break;
                 case $interlocutorId:
                     $finalDeletedStatus = 0;
                     break;
             }
             break;
     }
     // Change read status
     $qb = new QueryBuilder();
     $qb->update(Tbl::get('TBL_CONVERSATION_MESSAGES'))->set(new Field('deleted'), $finalDeletedStatus)->where($qb->expr()->equal(new Field('id'), $message->id));
     if ($status == self::STATUS_DELETED_YES and $message->receiverId == $myUserId) {
         $qb->set(new Field('read'), self::STATUS_READ_READ);
     }
     $affected = $this->query->exec($qb->getSQL())->affected();
     $this->correctConversationReadStatus($message->uuid, $myUserId);
     $this->correctConversationHasAttachment($message->uuid, $myUserId);
     $hookParams = array('type' => 'deletedStatus', 'msgId' => $message->id, 'newStatus' => $finalDeletedStatus);
     HookManager::callHook("ConversationMessageUpdate", $hookParams);
     return $affected;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:85,代码来源:ConversationManager.class.php

示例5: updateUserProperties

 /**
  * Updated User Properties
  * 
  * @param UserProperties $properties
  * @return integer Affected
  */
 protected function updateUserProperties(UserProperties $properties)
 {
     if (count($this->config->userPropertiesMap->toArray()) > 0) {
         $qb = new QueryBuilder();
         $qb->update(Tbl::get('TBL_USERS_PROPERTIES'));
         foreach ($this->config->userPropertiesMap as $objectKey => $dbKey) {
             $qb->set(new Field($dbKey), $properties->{$objectKey});
         }
         $qb->where($qb->expr()->equal(new Field('user_id'), $properties->userId));
         return $this->query->exec($qb->getSQL())->affected();
     }
     return 0;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:19,代码来源:UserManager.class.php


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