Problems with associated results

hello guys, check out this problem,
when I use it contain to bring the ex associates:

$this->Categories->find()->contain([‘Posts’ => function ($q) {
return $q->limit(5);

Let’s say I have 15 more posts I want to have only 5 posts in each category.

The cake only has 5 records in the first category and in the second category there are no records.

Would this be a mistake in the cake or?