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


PHP SelectQuery::orderBy方法代码示例

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


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

示例1: listVersionsHelper

 /**
  * Helper for {@see listVersions()} and {@see listVersionsForUser()} that filters duplicates
  * that are the result of the cartesian product performed by createVersionInfoFindQuery().
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  *
  * @return string[][]
  */
 private function listVersionsHelper(SelectQuery $query)
 {
     $query->orderBy($this->dbHandler->quoteColumn('id', 'ezcontentobject_version'));
     $statement = $query->prepare();
     $statement->execute();
     $results = array();
     $previousId = null;
     foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
         if ($row['ezcontentobject_version_id'] == $previousId) {
             continue;
         }
         $previousId = $row['ezcontentobject_version_id'];
         $results[] = $row;
     }
     return $results;
 }
开发者ID:emodric,项目名称:ezpublish-kernel,代码行数:24,代码来源:DoctrineDatabase.php

示例2: applyOrderBy

 /**
  * Apply order by parts of sort clauses to query
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  */
 public function applyOrderBy(SelectQuery $query)
 {
     foreach ($this->sortColumns as $column => $direction) {
         $query->orderBy($column, $direction === Query::SORT_ASC ? SelectQuery::ASC : SelectQuery::DESC);
     }
     // @todo Review needed
     // The following line was added because without it, loading sub user groups through the Public API
     // fails with the database error "Unknown column sort_column_0". The change does not break any
     // integration tests or legacy persistence tests, but it can break something else, so review is needed
     // Discussion: https://github.com/ezsystems/ezpublish-kernel/commit/8749d0977307858c3e2a7d82f3be90fa21973357#L1R102
     $this->sortColumns = array();
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:17,代码来源:SortClauseConverter.php


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