@karenshahmuradyan

Почему не работает order(user_full_name)?

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;
    }
  • Вопрос задан
  • 90 просмотров
Пригласить эксперта
Ответы на вопрос 1
@BorisKorobkov
Web developer
order([$this->getTable() . '.user_full_name'...

Таки нет такого поля в таблице.
Попробуйте в order просто 'user_full_name'. Или new Expression...
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы