wintercms / wintercms/winter

When using listExtendQuery with groupby, paginate seems not work

Open
#454 16 comments 0 reactions 1 assignee View on GitHub

@bennothommo is already working on this.

Since Nov 30, 2022.

needs review stale
Dominant language
PHP
Stars
1.5k
Forks
246
Avg merge
19h 2m
Merged PRs (30d)
7

Description

Winter CMS Build

Other (please specify below)

PHP Version

7.4

Database engine

MySQL/MariaDB

Plugins installed

No response

Issue description

Hello everyone.
I have a model listing, where I need to override the standard querie, using a groupBy that returns the desired results, according to the business rule. The values ​​that appear as "totals" in the pagination are correct.

The problem is, when doing this:
public function listExtendQuery($query)
{
$query->groupBy('column');
}

And when trying to move from one page to another, it just doesn't load. I get stuck on the first page.
See: the pagination widget is loaded, but it doesn't work when I click next page...

Does anyone have any ideas?

Steps to replicate

• Use any model with some data
• In the controller of above's model, use the listExtendQuery to override default querie using: $query->groupBy('some_column')
• Try to click in the next step indicator

Workaround

Nothing yet.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.