Answer the question
In order to leave comments, you need to log in
Why doesn't order(user_full_name) work?
public function getAllInvoices($where, $offset, $limit, $orderColumn, $orderDirection)
{
$this->setEntity(new \Platform\Invoice\Entity\Backoffice\InvoiceTableRow());
$select = new Select();
$select->from($this->getTable());
$select->columns([
'id',
'invoice_type',
'status',
'price',
'price_original',
'title',
'creation_date' => 'created',
]);
$select->join(
DbTables::TBL_USERS,
DbTables::TBL_USERS . '.id = ' . $this->getTable() . '.user_id',
[
'user_full_name' => new Expression("CONCAT(first_name,' ',last_name)"),
'user_id' => 'id'
],
Select::JOIN_LEFT
);
$select->where($where);
$select->offset(intval($offset));
$select->limit(intval($limit));
$select->group($this->getTable() . '.id');
$select->order([$this->getTable() . '.created' => Select::ORDER_DESCENDING])->
order([$this->getTable() . '.invoice_type' => Select::ORDER_DESCENDING])->
order([$this->getTable() . '.status' => Select::ORDER_DESCENDING])->
order([$this->getTable() . '.user_full_name' => Select::ORDER_DESCENDING])->
order([$this->getTable() . '.price' => Select::ORDER_DESCENDING]);
$select->quantifier(new Expression('SQL_CALC_FOUND_ROWS'));
$result = $this->executeSelect($select);
return $result;
}
Answer the question
In order to leave comments, you need to log in
order([$this->getTable() . '.user_full_name'...
new Expression...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question