CakePHP: How to limit number of records from associated model
- by azv
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!