I have 2 models, Subsite and News, with a belongsToMany association.
I’m trying to retrieve a Subsite and its associated News items. This bit is fine, but I’d like to paginate the News items which are returned.
My find query is:
$query = $subsites->find('all')
->where(['Subsites.name' => $subsite])
->contain(['News']);
I’m not sure whether it’s possible to paginate the News items or not; if so, where do I put the pagination array? I tried putting the following in my SubsitesTable:
public $paginate = [
'News' => [
'limit' => 25,
'order' => [
'News.date' => 'desc'
]
]
];
but I still get all news items returned. Thanks!