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

Document restrictions for postUpdate, postRemove and postPersist events #10875

Open
mpdude opened this issue Aug 3, 2023 · 2 comments
Open

Comments

@mpdude
Copy link
Contributor

mpdude commented Aug 3, 2023

Coming from #10869 and #10874:

May listeners for these post* events...

  • call EntityManager#flush() again?
  • make updates to managed entities, which might be due for processing in the currently running transaction?
@mpdude
Copy link
Contributor Author

mpdude commented Aug 17, 2023

Regarding updates to managed entities, I am concerned about when the UoW takes snapshots/updates originalEntityData. Does that happen before or after the events?

One potential issue I see is that the changesets may be computed, then the event fires and leads to entity modifications, and then the entity state is snapshotted/marked as clean. In that case, we might miss necessary updates (also in subsequent flushes).

Note the code paths are somewhat different for updates to plain attributes vs. collection updates.

@mpdude
Copy link
Contributor Author

mpdude commented Aug 17, 2023

Just realized that at the time where postPersist is emitted (during/at the end of UoW::executeInserts), there may still be pending extra updates (so the database does not 100% reflect the desired entity state). Also, collection updates did not yet happen, so many-to-many tables might be incomplete also.

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

No branches or pull requests

1 participant