Fernando Ferrari
Fernando Ferrari

Reputation: 586

Multiple column ORDERing in ZF?

i got this code

        $select
            ->from(array("e" => "embarcacoes"))
            ->join(array("i" => "imagens"), 'e.id = i.barcoId')
            ->where("e.tipo = '{$this->view->tipoEmbarcacao}'")
            ->group("i.barcoId")
            ->limitPage($paginaAtual, $porPagina)
            ->order('e.prioridade DESC');

it works well, if i change the ->order('prioridade DESC'); line to ->order('id DESC'); it still works well, but if i try:

->order('prioridade DESC, id DESC'); or ->order(array('prioridade DESC','id DESC'));

it doesnt work. What is the correct syntax to make multiple orderign in zend framework? Thanks.

Upvotes: 5

Views: 5776

Answers (1)

Fernando Ferrari
Fernando Ferrari

Reputation: 586

Got the solution,

i have to use like this

->order(array('e.prioridade DESC','e.id DESC'));

oh christ, such a beginner mistake.

Upvotes: 17

Related Questions