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


PHP QueryBuilder::orderBy方法代码示例

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


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

示例1: doOrdering

 /**
  * Datatable ordering
  *
  * @return null
  */
 public function doOrdering()
 {
     if ($this->isOrderable()) {
         for ($i = 0, $c = count($this->input['order']); $i < $c; $i++) {
             $order_col = (int) $this->input['order'][$i]['column'];
             $order_dir = $this->input['order'][$i]['dir'];
             if (!$this->isColumnOrderable($this->input['columns'][$order_col])) {
                 continue;
             }
             $column = $this->getOrderColumnName($order_col);
             $this->query->orderBy($column, $order_dir);
         }
     }
 }
开发者ID:Kirylka,项目名称:Scaffold,代码行数:19,代码来源:BaseEngine.php

示例2: sort

 /**
  * Sort data
  * @param  Sorting $sorting
  * @return static
  */
 public function sort(Sorting $sorting)
 {
     if (is_callable($sorting->getSortCallback())) {
         call_user_func($sorting->getSortCallback(), $this->data_source, $sorting->getSort());
         return $this;
     }
     $sort = $sorting->getSort();
     if (!empty($sort)) {
         foreach ($sort as $column => $order) {
             $this->data_source = $this->data_source->orderBy($column, $order);
         }
     } else {
         /**
          * Has the statement already a order by clause?
          */
         $order = $this->data_source->getQueryBuilder()->getClause('order');
         if (ArraysHelper::testEmpty($order)) {
             $this->data_source = $this->data_source->orderBy($this->primary_key);
         }
     }
     return $this;
 }
开发者ID:romanmatyus,项目名称:datagrid,代码行数:27,代码来源:NextrasDataSource.php

示例3: getChatSessionsLog

 public function getChatSessionsLog(MysqlPager $pager = null, $myUserId = null, $cacheMinutes = 0)
 {
     $sessions = array();
     $qb = new QueryBuilder();
     $qb->select(new Field("*", "chat_sess_log"))->from(Tbl::get('TBL_CHAT_SESSIONS_LOG'), "chat_sess_log");
     if ($myUserId !== null) {
         $orClause = new Orx();
         $orClause->add($qb->expr()->equal(new Field("user1_id", "chat_sess_log"), $myUserId));
         $orClause->add($qb->expr()->equal(new Field("user2_id", "chat_sess_log"), $myUserId));
         $qb->andWhere($orClause);
     }
     $qb->orderBy(new Field("datetime", "chat_sess_log"), MySqlDatabase::ORDER_DESC);
     $sqlQuery = $qb->getSQL();
     if ($pager !== null) {
         $this->query = $pager->executePagedSQL($sqlQuery, $cacheMinutes);
     } else {
         $this->query->exec($sqlQuery, $cacheMinutes);
     }
     if ($this->query->countRecords()) {
         while (($sesLogRow = $this->query->fetchRecord()) != null) {
             $chatSession = new ChatSessionLog();
             $chatSession->user1 = ChatUser::getObject($sesLogRow['user1_id']);
             $chatSession->user2 = ChatUser::getObject($sesLogRow['user2_id']);
             $chatSession->id = $sesLogRow['id'];
             $chatSession->closedDate = $sesLogRow['datetime'];
             array_push($sessions, $chatSession);
         }
     }
     return $sessions;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:30,代码来源:ChatSessionManager.class.php

示例4: mergeOrderByInto

 /**
  * Merge this QueryBuilder's ORDER BY into the given QueryBuilder.
  *
  * @param  QueryBuilder $QueryBuilder to merge into
  * @return QueryBuilder
  */
 public function mergeOrderByInto(QueryBuilder $QueryBuilder)
 {
     foreach ($this->orderBy as $currentOrderBy) {
         $QueryBuilder->orderBy($currentOrderBy['column'], $currentOrderBy['order']);
     }
     return $QueryBuilder;
 }
开发者ID:netconstructor,项目名称:QueryBuilder-1,代码行数:13,代码来源:QueryBuilder.php

示例5: search

 /**
  * Search in alyun opensearch
  * @param string $keyword
  * @param array $indexArr
  * @param array $postTypeArr
  * @param integer $cntPerpage
  * @param integer $pageNumber
  * @return array|mixed
  */
 public function search($vars, $keywors, $kwtype, $searchtype)
 {
     $options = $this->options;
     $search_obj = new \CloudsearchSearch($this->client);
     $search_obj->addIndex($options->getAppName());
     $search_obj->setFormat("json");
     $queryBuilder = new \QueryBuilder($search_obj);
     $queryBuilder->channelType($_REQUEST["channeltype"]);
     $queryBuilder->hits($vars["limitstart"], $vars["row"]);
     $queryBuilder->orderBy($_REQUEST["orderby"]);
     $queryBuilder->starttime($_REQUEST["starttime"]);
     $queryBuilder->typeId($_REQUEST["typeid"]);
     $queryBuilder->setSearch($searchtype, $kwtype, $keywors);
     //execute search
     $json = $search_obj->search();
     //convert result
     return json_decode($json, true);
 }
开发者ID:aliyun-beta,项目名称:dedeCMS-OpenSearch,代码行数:27,代码来源:OpenserachService.php


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