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

Re-enable persist in updateEntity() #3202

Merged
merged 1 commit into from May 8, 2020

Conversation

Pierstoval
Copy link
Contributor

Even though $em->persist($entity) does nothing for entities that are already managed by the EntityManager when they're fetched from a Repository or via a join, it is still mandatory to execute persist() on it for projects that use a different tracking policy: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/change-tracking-policies.html

My side-project Compotes uses this, and I noted a good impact in terms of performances and memory in dev (not benchmarked though) because a flush() doesn't need to check for all the entities in the memory, only the ones that were manually persisted.

And to make this work, an entity must be re-persisted if you want to update it in the database. Hence this PR.

@javiereguiluz
Copy link
Collaborator

Thanks for fixing this issue. Advanced Doctrine is something that I don't know well ... so thanks for explaining it in detail!

@javiereguiluz javiereguiluz merged commit dcbecff into EasyCorp:master May 8, 2020
@Pierstoval Pierstoval deleted the persist branch May 8, 2020 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants