Repository navigation
Record has changed (1020) on new entity #12494
Unanswered
pkly
asked this question in
Support Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello, I wanted to ask, since I'm not sure if what I'm doing is correct.
A while back I was working on a feature which sends out notifications, all of it is started in a transaction, entities are loaded or created only inside of it with no outside data.
Now, there was a weird issue I noticed (using mariadb:11.8.3 or possibly newer, likely caused by snapshot isolation being turned on), that sometimes I see the error 1020, Record has changed since last read in table X.
Which would be fine, if I actually attempted to read from the table. From what I noticed it seemed like doctrine re-reads the entity after it's created in a transaction? I'm not exactly sure.
The setup goes mostly like this:
I'm not exactly sure how or why this happens. Does doctrine read the entity it creates from the database at any point? Or am I doing something wrong.
While in this case I was able to achieve the expected behavior by not flushing until all the entities are ready and persisted, it's not always possible.
All reactions