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

[Autocomplete] Fix handling of associated properties in DQL joins #2377

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

HugoSEIGLE
Copy link

Q A
Bug fix? yes
New feature? no
Issues Fix #2370
License MIT

Changes:

  • The alias generation logic has been improved to correctly handle nested associations and avoid alias collisions.
  • The code was modified to ensure that the parent entity is correctly accounted for when generating aliases, which helps prevent issues in complex joins with multiple associated entities.
  • A check was added to verify the existence of a parent property before using it as part of the alias. This prevents logical errors in cases where the parent entity is not directly involved in the join.

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Nov 14, 2024
@smnandre smnandre changed the title Fix issue with incorrect handling of associated properties in DQL joins [Autocomplete] Fix handling of associated properties in DQL joins Nov 15, 2024
@smnandre
Copy link
Member

This seems very legit: do you think you could add a test or two ?

@HugoSEIGLE
Copy link
Author

This seems very legit: do you think you could add a test or two ?

Thank you for the feedback! I’ve already added tests in "Symfony\UX\Autocomplete\Tests\Functional\FieldAutocompleterTest". Let me know if there are fix to add or additional scenarios you'd like me to cover.

Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @HugoSEIGLE!

Thank you for the added tests!

To be honest I do feel this entire class deserves a big clean / refacto (code style, performance, and code readability)..

But this is way outside the scope of this PR.. that does fix a bug.. so thank you for this and we'll try to refactor it later.

:)

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Autocomplete Bug Bug Fix Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Autocomplete] (Searchable Fields): Incorrect search field selection due to similar field names
4 participants