Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling distinct() on QueryBuilder does not update state correctly #10784

Closed
macroparts opened this issue Jun 22, 2023 · 5 comments · Fixed by #10789
Closed

Calling distinct() on QueryBuilder does not update state correctly #10784

macroparts opened this issue Jun 22, 2023 · 5 comments · Fixed by #10789

Comments

@macroparts
Copy link

macroparts commented Jun 22, 2023

Bug Report

Q A
BC Break no
Version 2.14.3

Summary

When calling distinct() on a Query builder after getQuery(), then a subsequent getQuery() would ignore the distinct query part.

Current behavior

See summary

How to reproduce

  1. Use the QueryBuilder and create any non-distinct query.
  2. Call getQuery() on the QueryBuilder
  3. Call distinct() on the QueryBuilder
  4. Call getQuery() on the QueryBuilder again

Expected behavior

The second getQuery() call should return a Query using the distinct keyword.

@greg0ire
Copy link
Member

Looks like it would be fixed by adding $this->state = self::STATE_DIRTY inside distinct()… are you up to send a PR?

macroparts pushed a commit to macroparts/orm that referenced this issue Jun 23, 2023
Previously calling distinct() when the QueryBuilder was in clean state would cause subsequent getDQL() calls to ignore the distinct queryPart

Fixes doctrine#10784
@macroparts
Copy link
Author

@greg0ire hope I was following your contribution guidelines correctly. I will appreciate a review of my PR.

@greg0ire
Copy link
Member

Version | 2.x.x

What version are you using, precisely?

@macroparts
Copy link
Author

2.14.3 is currently used in my project and I was hoping to get a fix for that version but I can also aim for an upgrade and submit a fix for 2.15.x

@greg0ire
Copy link
Member

Please do, 2.14.x is no longer maintained.

macroparts pushed a commit to macroparts/orm that referenced this issue Jun 23, 2023
Previously calling distinct() when the QueryBuilder was in clean state would cause subsequent getDQL() calls to ignore the distinct queryPart

Fixes doctrine#10784
greg0ire pushed a commit to macroparts/orm that referenced this issue Jun 25, 2023
Previously calling distinct() when the QueryBuilder was in clean state would cause subsequent getDQL() calls to ignore the distinct queryPart

Fixes doctrine#10784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants