Warning: Illegal string offset '_imagedir' in /home/cakephpf/public_html/lofiversion/index.php on line 545

Warning: Illegal string offset '_emodir' in /home/cakephpf/public_html/lofiversion/index.php on line 546
CakePHP UnOfficial Community Forum > cakephp using paginate and order
Help - Search - Member List - Calendar
Full Version: cakephp using paginate and order
CakePHP UnOfficial Community Forum > General CakePHP Discussions

lolalola
Hi,
why not work "order" function?


CODE
$this->paginate = array(
               'limit' => 5,
               'order' => array(
                   'User.name' => 'desc'
               ),
               'fields' => array('Post.id', 'Post.title', 'User.name AS aut_name'),                        
               'joins' => array(
                   array(
                       'table' =>'users',
                       'alias' =>'User',
                       'type' =>'LEFT',
                       'conditions' => array(
                           'Post.user_id = User.user_id'
                       )
                   )
               )
       );  

       $posts = $this->paginate();
       $this->set(compact('posts'));

endyourif
Are you getting an error, not very descriptive as to what the problem is...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.
Lo-Fi 1.1 iDS Beta, Originally written by Matt,
re-written by Shaun Harrison, Layer 04.com, for pre IPB2.0 versions.