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

Fix Entity Hydration Issue for Inherited Entities with DiscriminatorMap #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

james2001
Copy link
Contributor

Problem Description

In the existing system, the hydration of entities resulting from a search query is not geared towards entity hierarchies that have a DiscriminatorMap. This leads to a "ResultSetMapping builder does not currently support your inheritance scheme" error when attempting to use ResultSetMappingBuilder with entities that have an inheritance hierarchy.

Proposed Solution

Instead of relying on a native SQL query and ResultSetMappingBuilder, this PR employs DQL to fetch the entities, which natively supports DiscriminatorMap. After fetching the entities using DQL, we use usort in PHP to sort them in the desired order. This allows us to circumvent the aforementioned error while retaining the ability to sort the entities.

This also likely fixes Issue #87 as we no longer use the FIELD function in our queries.

@npotier
Copy link
Member

npotier commented Oct 19, 2023

Hello @james2001 thank you for this PR, it looks very interesting.

I'll try review it soon.

@james2001
Copy link
Contributor Author

@npotier Any news on this PR?

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 this pull request may close these issues.

2 participants