0

I’m having some issues with the pagination of a custom collection, if I call the following methods:

$this->matchesCollection->setPageSize($pageSize)->setCurPage(++$page);

and

$this->matchesCollection->getSelect()->__toString();

it returns the following part of a query: …= 0 LIMIT 100000

So, it has a limitation, but where did the offset go?

If the initial value of $page is larger than 1, there’s an offset, but the offset doesn’t increment, so apparently the query gets cached, is there any way to disable this?

Another method I tried is:

$pageRows = $this->matchesCollection->getSelect()->limit($pageSize, ($page * $pageSize));

The query seems to be right, but I guess this is not the recommended method and I don't have a clue about how to iterate through the $pageRows variable, whereas, with the setCurPage() method I can use foreach ($pageRows as $item) {}.

Any help is much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.