CakePHP: How to limit number of records from associated model

Posted by azv on Stack Overflow See other posts from Stack Overflow or by azv
Published on 2010-05-31T08:17:35Z Indexed on 2010/05/31 8:22 UTC
Read the original article Hit count: 164

Filed under:
|

In a simple CakePHP model where User hasMany Item (and Item belongsTo User)- Suppose 50 users, have each 10 items. How can I find() only 5 users, each with the latest 5 items he has? When I impose a limit in the find, it only limits the number of users, not the number of associated Items.

Thanks!

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about django-models