cakephp - order by timestamp DESC not working -


i have table called posts stores posts . has 2 columns "created" , "modified" .

below query in model :

$options = [             'conditions' => [                 'circle_id'                => $my_circle_list,                 'team_id'                  => $this->current_team_id,                 'modified between ? , ?' => [$start, $end],             ],             'order'      => ['modified'=> 'desc'],             'limit'      => $limit,             'fields'     => ['post_id'],         ];         $res = $this->find('list', $options); 

now want latest edited posts on top , below mysql dump reads :

select `post`.`id` `db`.`posts` `post`   `post`.`id` in (125, 124) , `post`.`del_flg` = '0'   order `post`.`modified` desc  limit 20 

if run query in database editor ,it gives correct output , in controller ordering changes again , figured after debugged array values.

would helpful if tell me if there's specific reason behind . call model method controller done in conventional manner .

when using $this->find() after cake has queried database generated sql calls afterfind() method on model can manipulate data. place ordering have been modified.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -