Is there any way I can order the Comments listing by a field in the
Post table?
<?php
class Post extends AppModel
{
var $name = 'Post';
//add the following $hasMany definition
var $hasMany = array('Comment' =>
array('className' => 'Comment',
'conditions' => '',
'order' => 'Comment.created DESC',
'limit' => '5',
'foreignKey' => 'post_id',
'dependent' => true,
'exclusive' => false,
'finderQuery' => '',
'fields' => '',
'offset' => '',
'counterQuery' => ''
)
);
var $validate = array(
'title' => VALID_NOT_EMPTY,
'body' => VALID_NOT_EMPTY
);
}
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---