本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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));
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例9: sort
/**
* @param array $sorting
*/
public function sort(array $sorting)
{
foreach ($sorting as $column => $sort) {
$this->selection->order("{$column} {$sort}");
}
}
示例10: orderBy
public function orderBy($row, $sorting = 'ASC')
{
return $this->nette_table->order($row . ' ' . $sorting);
}
示例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);
}
示例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');
}
示例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;
}
示例14: order
function order($columns)
{
if (!$this->order) {
$this->order[] = "{$this->delimitedName}.{$this->delimitedColumn}" . (preg_match('~\\bDESC$~i', $columns) ? ' DESC' : '');
}
return parent::order($columns);
}
示例15: orderBy
public function orderBy($row, $sorting = 'ASC')
{
return $this->netteTable->order($this->prefixColumn($row) . ' ' . $sorting);
}