XF 2.1 How to limit number of results for a post finder?

Pol57

Member
I'm already limiting by page, but can I also limit the code below so the total results is limited to 1000?

Code:
$posts = $postList->limitByPage($page, $perPage)->fetch();
 
Code:
->limit()
Thanks, but I've tried that (in two different places) and it appears to make no change. Am I doing something very silly wrong?

Code:
        $postRepo = $this->getPostRepo();


                $postList = $postRepo->finder('XF:Post');
                $postList
                    ->whereSql("xf_post.thread_id IN ($sthreadid)")
                    ->limit(8);

        $posts = $postList->limit(10)->fetch();
 
Back
Top Bottom