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


PHP Selection::order方法代码示例

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


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

示例1: appendSort

 static function appendSort(Nette\Database\Table\Selection &$query, $sort = NULL)
 {
     if (!is_null($sort)) {
         foreach ($sort as $k => $v) {
             if (Nette\Utils\Validators::isNumericInt($k)) {
                 $query->order($v);
             } else {
                 $query->order($k . ' ' . strtoupper($v));
             }
         }
     }
     return $query;
 }
开发者ID:trejjam,项目名称:utils,代码行数:13,代码来源:BaseQuery.php

示例2: order

 public function order($columns)
 {
     if (!$this->sqlBuilder->getOrder()) {
         // improve index utilization
         $this->sqlBuilder->addOrder("{$this->name}.{$this->column}" . (preg_match('~\\bDESC$~i', $columns) ? ' DESC' : ''));
     }
     return parent::order($columns);
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:8,代码来源:GroupedSelection.php

示例3: sort

 /**
  * Adds ordering to specified column
  *
  * @param string column name
  * @param string one of ordering types
  * @return IDataSource (fluent)
  * @throws \Nette\InvalidArgumentException
  */
 public function sort($column, $order = IDataSource::ASCENDING)
 {
     if (!$this->hasColumn($column)) {
         throw new \Nette\InvalidArgumentException('Trying to sort data source by unknown column.');
     }
     $this->selection->order($this->mapping[$column] . ' ' . ($order === self::ASCENDING ? 'ASC' : 'DESC'));
     return $this;
 }
开发者ID:lohini,项目名称:cf,代码行数:16,代码来源:DB.php

示例4: actionDefault

 /**
  * Pad:default.
  * @param int         $id
  * @param string|null $order
  * @throws BadRequestException
  */
 public function actionDefault($id, $order)
 {
     $this->loadPad($id);
     $this->notes = $this->noteManager->findByPad($id);
     if ($order) {
         $this->notes->order(OrderHelper::translateParameterToColumns($order));
     }
 }
开发者ID:shutkos,项目名称:notejam,代码行数:14,代码来源:PadPresenter.php

示例5: order

 public function order($columns)
 {
     if (!$this->order) {
         // improve index utilization
         $this->order[] = "{$this->delimitedName}.{$this->delimitedColumn}" . (preg_match('~\\bDESC$~i', $columns) ? ' DESC' : '');
     }
     return parent::order($columns);
 }
开发者ID:bazo,项目名称:Tatami,代码行数:8,代码来源:GroupedSelection.php

示例6: orderBy

 /**
  * API:
  *
  * <code>
  * $this->orderBy('column', EntityCollection::DESC); // ORDER BY [column] DESC
  * // or
  * $this->orderBy(array(
  *	'first'  => EntityCollection::ASC,
  *	'second' => EntityCollection::DESC,
  * ); // ORDER BY [first], [second] DESC
  * </code>
  *
  * @param  string|array $column
  * @param  bool $dir
  * @return EntityCollection
  */
 public function orderBy($column, $dir = NULL)
 {
     if (is_array($column)) {
         foreach ($column as $col => $d) {
             $this->orderBy($col, $d);
         }
     } else {
         $dir === NULL && ($dir = static::ASC);
         $this->selection->order($column . ($dir === static::DESC ? ' DESC' : ''));
     }
     $this->invalidate();
     return $this;
 }
开发者ID:uestla,项目名称:yetorm,代码行数:29,代码来源:EntityCollection.php

示例7: sort

 /**
  * Order data
  * @param  array  $sorting
  * @return self
  */
 public function sort(array $sorting)
 {
     if ($sorting) {
         $this->data_source->getSqlBuilder()->setOrder([], []);
         foreach ($sorting as $column => $sort) {
             $this->data_source->order("{$column} {$sort}");
         }
     } else {
         /**
          * Has the statement already a order by clause?
          */
         if (!$this->data_source->getSqlBuilder()->getOrder()) {
             $this->data_source->order($this->primary_key);
         }
     }
     return $this;
 }
开发者ID:martinknor,项目名称:datagrid,代码行数:22,代码来源:NetteDatabaseTableDataSource.php

示例8: 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)) {
         $this->data_source->getSqlBuilder()->setOrder([], []);
         foreach ($sort as $column => $order) {
             $this->data_source->order("{$column} {$order}");
         }
     } else {
         /**
          * Has the statement already a order by clause?
          */
         if (!$this->data_source->getSqlBuilder()->getOrder()) {
             $this->data_source->order($this->primary_key);
         }
     }
     return $this;
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:27,代码来源:NetteDatabaseTableDataSource.php

示例9: sort

 /**
  * @param array $sorting
  */
 public function sort(array $sorting)
 {
     foreach ($sorting as $column => $sort) {
         $this->selection->order("{$column} {$sort}");
     }
 }
开发者ID:cujan,项目名称:vcelyweb,代码行数:9,代码来源:NetteDatabase.php

示例10: orderBy

 public function orderBy($row, $sorting = 'ASC')
 {
     return $this->nette_table->order($row . ' ' . $sorting);
 }
开发者ID:adusak,项目名称:DataGrid,代码行数:4,代码来源:NetteDbDataSource.php

示例11: order

 function order($columns)
 {
     if (!$this->sqlBuilder->getOrder()) {
         $this->sqlBuilder->addOrder("{$this->name}.{$this->column}" . (preg_match('~\\bDESC\\z~i', $columns) ? ' DESC' : ''));
     }
     return parent::order($columns);
 }
开发者ID:rotten77,项目名称:xcv,代码行数:7,代码来源:nette.min.php

示例12: orderAndFetch

 /**
  * @param \Nette\Database\Table\Selection $context
  * @return array
  */
 protected function orderAndFetch(Selection $context)
 {
     return $context->order('section.priority ASC, section.name ASC')->fetchPairs('id', 'name');
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:8,代码来源:SectionOptionFactory.php

示例13: order

 /**
  * Adds order clause, more calls appends to the end.
  * @param string $columns
  * @return self
  */
 public function order($columns)
 {
     $this->selection->order($columns);
     return $this;
 }
开发者ID:jkrecek,项目名称:nette-database-model,代码行数:10,代码来源:StoredCollection.php

示例14: order

 function order($columns)
 {
     if (!$this->order) {
         $this->order[] = "{$this->delimitedName}.{$this->delimitedColumn}" . (preg_match('~\\bDESC$~i', $columns) ? ' DESC' : '');
     }
     return parent::order($columns);
 }
开发者ID:Vrtak-CZ,项目名称:NJLogParser,代码行数:7,代码来源:nette.min.php

示例15: orderBy

 public function orderBy($row, $sorting = 'ASC')
 {
     return $this->netteTable->order($this->prefixColumn($row) . ' ' . $sorting);
 }
开发者ID:mesour,项目名称:sources,代码行数:4,代码来源:NetteDbTableSource.php


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