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


PHP Doctrine_Query::addOrderBy方法代码示例

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


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

示例1: buildQueryOrder

 /**
  * Build the order part from the query.
  *
  * The first arg is the field to be ordered and the $order
  * arg is the correspondent order (ASC|DESC)
  *
  * If the $reset is set to true, all previous order should be removed
  *
  * @param string $field
  * @param string $order
  * @param bool $reset
  * @return Bvb_Grid_Source_Doctrine
  */
 public function buildQueryOrder($field, $order, $reset = false)
 {
     if ($reset) {
         $this->_query->removeDqlQueryPart('orderby');
     }
     $this->_query->addOrderBy($field . ' ' . $order);
     return $this;
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:21,代码来源:Doctrine.php

示例2: tryToSortWithForeignColumn

 protected function tryToSortWithForeignColumn(Doctrine_Query $query, array $sort)
 {
     $table = $this->getDmModule()->getTable();
     if ('integer' === dmArray::get($table->getColumnDefinition($sort[0]), 'type')) {
         if ($table->isI18nColumn($sort[0])) {
             $query->addOrderBy(sprintf('%s.%s %s', $query->getJoinAliasForRelationAlias($table->getComponentName(), 'Translation'), $sort[0], $sort[1]));
             // Success, skip default sorting by local column
             return;
         } elseif ($relation = $table->getRelationHolder()->getLocalByColumnName($sort[0])) {
             if ($relation instanceof Doctrine_Relation_LocalKey && ($foreignTable = $relation->getTable()) instanceof dmDoctrineTable) {
                 if (($foreignColumn = $foreignTable->getIdentifierColumnName()) != 'id') {
                     if (!($joinAlias = $query->getJoinAliasForRelationAlias($table->getComponentName(), $relation->getAlias()))) {
                         $query->leftJoin(sprintf('%s.%s %s', $query->getRootAlias(), $relation->getAlias(), $relation->getAlias()));
                         $joinAlias = $relation->getAlias();
                         if ($foreignTable->isI18nColumn($foreignColumn)) {
                             $query->leftJoin(sprintf('%s.%s %s', $joinAlias, 'Translation', $joinAlias . 'Translation'));
                         }
                     }
                     if ($foreignTable->isI18nColumn($foreignColumn)) {
                         $query->addOrderBy(sprintf('%s.%s %s', $joinAlias . 'Translation', $foreignColumn, $sort[1]));
                     } else {
                         $query->addOrderBy(sprintf('%s.%s %s', $joinAlias, $foreignColumn, $sort[1]));
                     }
                     // Success, skip default sorting by local column
                     return;
                 }
             }
         }
     } elseif ($table->isI18nColumn($sort[0])) {
         $query->addOrderBy(sprintf('%s.%s %s', $query->getJoinAliasForRelationAlias($table->getComponentName(), 'Translation'), $sort[0], $sort[1]));
         // Success, skip default sorting by local column
         return;
     }
     if ($table->hasField($sort[0])) {
         $query->addOrderBy($sort[0] . ' ' . $sort[1]);
     }
 }
开发者ID:jdart,项目名称:diem,代码行数:37,代码来源:dmAdminBaseGeneratedModuleActions.php

示例3: hookOrderby

 /**
  * hookOrderBy
  * builds DQL query orderby part from given parameter array
  *
  * @param array $params         an array containing all fields which the built query
  *                              should be ordered by
  * @return boolean              whether or not the hooking was successful
  */
 public function hookOrderby($params)
 {
     if (!is_array($params)) {
         return false;
     }
     foreach ($params as $name) {
         $e = explode(' ', $name);
         $order = 'ASC';
         if (count($e) > 1) {
             $order = $e[1] == 'DESC' ? 'DESC' : 'ASC';
         }
         $e = explode('.', $e[0]);
         if (count($e) == 2) {
             list($alias, $column) = $e;
             $map = $this->query->getAliasDeclaration($alias);
             $table = $map['table'];
             if ($def = $table->getDefinitionOf($column)) {
                 $this->query->addOrderBy($alias . '.' . $column . ' ' . $order);
             }
         }
     }
     return true;
 }
开发者ID:darkcolonist,项目名称:kohana234-doctrine115,代码行数:31,代码来源:Hook.php

示例4: rec_query_add_sort

 /**
  * Add sort to Doctrine_Query.
  *
  * @param Doctrine_Query $q
  * @param string $fld
  * @param string $dir
  */
 protected function rec_query_add_sort(Doctrine_Query $q, $fld, $dir)
 {
     $q->addOrderBy("{$fld} {$dir}");
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:11,代码来源:DOCframe_Resource.php

示例5: addOrderByPositionOption

 /**
  * Adds orderby option to the query on the <field_name>
  *
  * @param Doctrine_Query $q
  */
 private function addOrderByPositionOption(Doctrine_Query $q, $table_alias = 't', $filed_name = 'position')
 {
     $q->addOrderBy($table_alias . '.' . $filed_name);
 }
开发者ID:kmatu,项目名称:phpcollab3,代码行数:9,代码来源:idIssueForm.class.php

示例6: addSortQuery

 protected function addSortQuery(Doctrine_Query $query)
 {
     $sort = $this->getSort();
     if ($sort) {
         $query->addOrderBy(sprintf("%s %s", $sort[0], $sort[1]));
     }
 }
开发者ID:rmhdev,项目名称:sfSesame,代码行数:7,代码来源:actions.class.php

示例7: rec_query_add_sort

 /**
  * Handle custom sorters
  *
  * @param Doctrine_Query $q
  * @param string $fld
  * @param string $dir
  */
 protected function rec_query_add_sort(Doctrine_Query $q, $fld, $dir)
 {
     if ($fld == 'cre_username') {
         $q->addOrderBy("cu.user_username {$dir}");
     } elseif ($fld == 'upd_username') {
         $q->addOrderBy("uu.user_username {$dir}");
     } else {
         parent::rec_query_add_sort($q, $fld, $dir);
     }
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:17,代码来源:user.php

示例8: addSortQuery

 /**
  * Add sort query
  * 
  * @param   Doctrine_Query  $q
  * @return  void
  */
 protected function addSortQuery($q)
 {
     $q->addOrderBy('root_id, lft');
 }
开发者ID:relo-san,项目名称:dinStaticPlugin,代码行数:10,代码来源:actions.class.php


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