连接表排序的CakePHP分页不适用于连接表字段.但是对于自定义的sql join查询工作正常.请帮我出来
原文链接:https://www.f2er.com/php/139358.html看下面的示例代码..我有Artist.name连接表字段顺序.
$this->paginate = array( 'fields' => array( 'id','Song.title','Song.date','Artist.id AS artist_id','Artist.name AS artist_name','COUNT(SongViews.id) AS views' ),'group' => array('ArtistsSong.song_id'),'recursive' => 0,'limit' => 20,'joins' => array( array( 'table' => 'tbl_artists_songs','alias' => 'ArtistsSong','conditions'=> array('Song.id = ArtistsSong.song_id') ),array( 'table' => 'tbl_artists','alias' => 'Artist','conditions'=> array('Artist.id = ArtistsSong.artist_id') ),array( 'table' => 'tbl_song_views','alias' => 'SongViews','type' => 'left','conditions'=> array('SongViews.song_id = ArtistsSong.song_id') ),),'order' => array('Artist.name'=>'asc') );