Hi I'm trying to to do pagination from the KindsController but with data from the LinkModel
Tables :
  Kinds       links          
     id           id
     name         title
     order        url
                  kind_id
                  order
model:
class Kind extends AppModel{
        var $name = 'Kind';
        var $hasMany = 'Link';
    }
controller:
class KindsController extends AppController{
    var $name = 'Kinds';
    var $paginate = array(
        'Kind'=> array(
            'limit' => 12,
            'order'=> array('Kind.order'=>'ASC')
        )
    );
}
desired result (view) ;
 Kind.name ( numbers of links )
开发者_StackOverflow社区    links.name
    ........
    ..........
    Kind.name ( numbers of links )
    links.name
    ........
    ..........
i'm using the kinds.order and links.order to control how the data is displayed in the view from an admin area.
i need to retrive data from the kinds table ordered by kinds.order ASC and the number of links, and the links data ordered by links.order
thanks
You can define order in the relation like this:
class Kind extends AppModel{
    var $hasMany = array(
        'Link' => array(
            'className' => 'Link',
            'order' => 'Link.name'
        ),
    );
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论