# How can I paginate an associated model?

**URL:** <https://discourse.cakephp.org/t/how-can-i-paginate-an-associated-model/1455>\
**Category:** Need Help\
**Created:** [November 4, 2016, 4:52pm UTC](https://discourse.cakephp.org/t/how-can-i-paginate-an-associated-model/1455 "2016-11-04T16:52:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jimgwhit](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/jimgwhit/32/378_2.png) [@jimgwhit](https://discourse.cakephp.org/u/jimgwhit)\
**Post date:** [November 5, 2016, 3:21am UTC](https://discourse.cakephp.org/t/how-can-i-paginate-an-associated-model/1455/2 "2016-11-05T03:21:06Z")

</div>

Leave parenthesis blank:

```auto
$query = $subsites->find()
                                ->where(['Subsites.name' => $subsite])
                                ->contain(['News']);

```

Something like that. In one of mine I use a custom pagination and looks like:

```auto
$query = $dogs->find()
                ->where(['adopted' => 0])
                ->orderAsc('sex')
                ->orderDesc('lastedit')
                ->limit($rowsperpage)
                ->page($pg);

```

---

_[View the full topic](https://discourse.cakephp.org/t/how-can-i-paginate-an-associated-model/1455)._
