Skip to content

[LiveComponent] Fix (de)hydration of composite and/or foreign ID entities #1957

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

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

MatTheCat
Copy link
Contributor

@MatTheCat MatTheCat commented Jul 4, 2024

Q A
Bug fix? yes
New feature? no
Issues N/A
License MIT

This PR fixes two issues (tests included) with the DoctrineEntityHydrationExtension:

  • Entities with composite IDs couldn’t be hydrated because in this case the object manager needs the properties as keys. Throwing if the 0 key does not exist prevents this to work, so this PR removes this check.
  • Dehydrated entities whose ID is a foreign key would bear the corresponding entity (or proxy), preventing their future correct hydration. This PR dehydrates ID values as well if needed.

@carsonbot carsonbot added Bug Bug Fix LiveComponent Status: Needs Review Needs to be reviewed labels Jul 4, 2024
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 5, 2024
@kbond
Copy link
Member

kbond commented Jul 5, 2024

This is great, thanks Mathieu!

@kbond kbond merged commit d0bb978 into symfony:2.x Jul 5, 2024
35 checks passed
@MatTheCat MatTheCat deleted the doctrine_entity_hydration branch July 5, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix LiveComponent Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants