次のようにモデルPost
とモデルがComment
関連付けられているとします。
Post hasMany Comment
Comment belongsTo Post
関連する latest を使用find('all')
して every を取得するにはどうすればよいですか?Post
Comment
hasOne
私は関係を次のように定義しようとしPost
ました:
var $hasOne = array('LatestComment' => array('className' => 'Comment', 'order' => 'LatestComment.created DESC'));
しかし、私が a を行うと、ごとに 1 回、異なるに設定して、複数回Post->find('all')
ごとに返されます。Post
Comment
LatestComment
Comments