Hi , This is the first time I post a request to this group. I wish I could find a solution for this problem.
2 tables are post ( id int not null auto_increment, latest_content_id int null primary key(id) ) postcontent( id int not null auto_increment, title varchar(255) not null, body text null, primary key(id) ) Model->Post: class Post extends AppModel { var $name = 'Post'; function paginateCount($conditions = null, $recursive = null) { $this->bindModel(array( 'belongsTo' => array( 'Postcontent' => array('className' => 'Postcontent', 'foreignKey' => 'latest_content_id', 'dependent' => false, 'conditions' => '', 'fields' => 'Postcontent.title', 'order' => '', 'limit' => '1', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ) )); return $this->findCount($conditions, $recursive); } function paginate($conditions = null, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) { $this->bindModel(array( 'belongsTo' => array( 'Postcontent' => array('className' => 'Postcontent', 'foreignKey' => 'latest_content_id', 'dependent' => false, 'conditions' => '', 'fields' => 'Postcontent.title', 'order' => '', 'limit' => '1', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ) )); return $this->findAll($conditions, $fields, $order, $limit, $page, $recursive); } } class Postcontent extends AppModel { var $name = 'Postcontent'; } View: <th width="30%"><?php echo $paginator- >sort('Title','Postcontent.title');?></th> SQL: SELECT COUNT(*) AS `count` FROM `posts` AS `Post` LEFT JOIN `postcontents` AS `Postcontent` ON (`Post`.`latest_content_id` = `Postcontent`.`id`) WHERE 1 = 1 1 1 1 SELECT `Post`.`id`, `Post`.`sequence`, `Post`.`postcategory_id`, `Post`.`latest_content_id`, `Post`.`live_content_id`, `Post`.`isFeatured`, `Post`.`isActive`, `Post`.`created`, `Post`.`createdBy`, `Post`.`modified`, `Post`.`modifiedBy`, `Postcontent`.`title`, `Postcontent`.`poststatus_id` FROM `posts` AS `Post` LEFT JOIN `postcontents` AS `Postcontent` ON (`Post`.`latest_content_id` = `Postcontent`.`id`) WHERE 1 = 1 LIMIT 30 When I do the paginate on view. I found the Postcontent.title can NOT be sorted. The SQL only does not work on join table field. Is a bug of Cakephp? If not, what's wrong on my code. BTW, the version of cakephp I use is 1.2.0.7692 RC3. Thanks in advance. Felix Jie Rong --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---