本文整理汇总了PHP中Magento\Framework\DB\Select::order方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::order方法的具体用法?PHP Select::order怎么用?PHP Select::order使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DB\Select
的用法示例。
在下文中一共展示了Select::order方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderOrders
/**
* Render sql select orders
*
* @return $this
*/
protected function _renderOrders()
{
if (!$this->_isOrdersRendered) {
foreach ($this->_orders as $field => $direction) {
$this->_select->order(new \Zend_Db_Expr($field . ' ' . $direction));
}
$this->_isOrdersRendered = true;
}
return $this;
}
示例2: _loadPriceDataSelect
/**
* Order by qty
*
* @param \Magento\Framework\DB\Select $select
* @return \Magento\Framework\DB\Select
*/
protected function _loadPriceDataSelect($select)
{
$select->order('qty');
return $select;
}
示例3: orderRand
/**
* Adds order by random to select object
* Possible using integer field for optimization
*
* @param Select $select
* @param string $field
* @return $this
*/
public function orderRand(Select $select, $field = null)
{
if ($field !== null) {
$expression = new \Zend_Db_Expr(sprintf('RAND() * %s', $this->quoteIdentifier($field)));
$select->columns(array('mage_rand' => $expression));
$spec = new \Zend_Db_Expr('mage_rand');
} else {
$spec = new \Zend_Db_Expr('RAND()');
}
$select->order($spec);
return $this;
}
示例4: processSortOrder
/**
* Process ORDER BY clause
*
* @param Select $select
* @return void
*/
protected function processSortOrder(Select $select)
{
foreach ($this->sortOrder as $direction => $column) {
if (!in_array($direction, [Select::SQL_ASC, Select::SQL_DESC])) {
$direction = '';
}
$expr = new \Zend_Db_Expr(sprintf('%s %s', $this->adapter->quoteIdentifier('lookup.' . $column), $direction));
$select->order($expr);
}
}