Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 836
Fernando Ferrari Avatar asked Dec 06 '22 07:12

Fernando Ferrari


1 Answers

Got the solution,

i have to use like this

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

oh christ, such a beginner mistake.

like image 60
Fernando Ferrari Avatar answered Dec 30 '22 16:12

Fernando Ferrari