本文整理匯總了PHP中Nette\Database\Table\Selection::getSqlBuilder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Selection::getSqlBuilder方法的具體用法?PHP Selection::getSqlBuilder怎麽用?PHP Selection::getSqlBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Database\Table\Selection
的用法示例。
在下文中一共展示了Selection::getSqlBuilder方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例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)) {
$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;
}