# Return n first items

**URL:** <https://discourse.cakephp.org/t/return-n-first-items/10051>\
**Category:** Need Help\
**Created:** [January 5, 2022, 11:51pm UTC](https://discourse.cakephp.org/t/return-n-first-items/10051 "2022-01-05T23:51:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ndm](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/ndm/32/2234_2.png) [@ndm](https://discourse.cakephp.org/u/ndm)\
**Post date:** [January 6, 2022, 4:47pm UTC](https://discourse.cakephp.org/t/return-n-first-items/10051/3 "2022-01-06T16:47:47Z")

</div>

Hello darkness my old friend…

> [@Limit contained record - not working!](https://discourse.cakephp.org/t/limit-contained-record-not-working/9872/3):
>
> That’s due to how the ORM works, associated data is either retrieved in a separate query (hasMany/belongsToMany), or in a join (hasOne/belongsTo, this can also be changed to use a separate query). For the former if you apply a limit, it will limit the overall number of associated records, not the records “per parent”. You could give [icings/partitionable](https://github.com/icings/partitionable) a try. Also check [cakephp - How to limit contained associations per record/group? - Stack Overflow](https://stackoverflow.com/questions/30241975/how-to-limit-contained-associations-per-record-group/30270675#30270675) for some additional workarounds.

---

_[View the full topic](https://discourse.cakephp.org/t/return-n-first-items/10051)._
