Idhae
Active member
Hey togther,
i need some advice.
How can I get a limited number of threads from thread finder and use the pagination stuff at the same time?
If i do the ->limit in the repository of my custom findThreadsWithMostLiked the limitByPage in the controller overwrides the custom limit.
That line $threadFinder->limitByPage... seems to work but $total is not limited, $total gets all threads mathing without ->limit.
i need some advice.
How can I get a limited number of threads from thread finder and use the pagination stuff at the same time?
PHP:
public function actionMostLiked()
{
$limitThreadsResults = 10; // for performance reasons
$page = $this->filterPage();
$perPage = $this->options()->discussionsPerPage;
$threadFinder = $this->getThreadRepo()->findThreadsWithMostLiked();
$threadFinder->limitByPage($page, $perPage )->limit($limitThreadsResults);
$total = $threadFinder->total();
If i do the ->limit in the repository of my custom findThreadsWithMostLiked the limitByPage in the controller overwrides the custom limit.
That line $threadFinder->limitByPage... seems to work but $total is not limited, $total gets all threads mathing without ->limit.
Last edited: