mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
UnitOfWork still not right - probably Enum-related #7074
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThomasLandauer on GitHub (Nov 24, 2022).
BC Break Report
Summary
I think I'm observing the same issue as https://github.com/doctrine/orm/issues/10124, but it wasn't fixed by 2.13.4, so I'm posting it separately.
I have a table with some thousand entries, and when I change a single one (through a Symfony form), all are getting "updated" (i.e. overwritten with their current values).
The last version, which really works for me, is 2.13.1.
2.13.2 introduced the error:
This was fixed in 2.13.3, but since then, persisting a single changed entity takes several minutes.
How to reproduce
I tried
dd($this->getEntityManager()->getUnitOfWork());, but couldn't find any differences between the working and non-working versions - where should I look at to provide more information?@derrabus commented on GitHub (Nov 24, 2022):
Share a repository that reproduces the problem, please.
@michnovka commented on GitHub (Dec 7, 2022):
@ThomasLandauer I have some spare time to look into this issue, if you could provide a test (ideally) or a repo with the broken logic and steps to reproduce. Thanks
@ThomasLandauer commented on GitHub (Dec 7, 2022):
Thanks for reminding - I just tried to reproduce this, but didn't succeed yet :-(
In my real project the same operation (form submission to persist 1 small change) takes:
When trying to reproduce it, my problem is that I don't know where to look at :-( So I'm only after the speed difference - but when running on a local machine with a small SQLite database, everything is quite fast...
Do you maybe have some hints for me about what I could dump?? Any "usual suspects"?
@michnovka commented on GitHub (Dec 8, 2022):
So you are not certain they are all getting updated? You only assume that based on time it takes? Did u confirm with symfony debugger list of executed queries?
@ThomasLandauer commented on GitHub (Dec 8, 2022):
Sorry, I still had a 303-redirect in place yesterday...
So here we go - here's a reproducer: https://github.com/ThomasLandauer/doctrine-issue-10251
Just get the database going (see README.md), open
public/index.phpand click the "Save" button (don't change thenamevalue).=> You should see 504 queries in the Symfony web toolbar (500 of them are
UPDATE)Took me some time to reproduce, cause the issue only occurs if many requirements are met:
$mainRepository->findWhatever();)->findAll()or similar)@michnovka commented on GitHub (Dec 8, 2022):
aha, so this is an array of enums. ok, might explain the issues. I will look into this and let you know my findings, hopefully a fix also. thanks for the example
@ThomasLandauer commented on GitHub (Dec 8, 2022):
One more observation: I think (didn't verify) the 500 entities being updated are always a subset of the "unrelated" query in the controller.
@michnovka commented on GitHub (Dec 8, 2022):
I was able to isolate the issue and implement a fix - https://github.com/doctrine/orm/pull/10277