mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
UnitOfWork state formation when loading entity with inverse side #6485
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 @berrymore on GitHub (Jun 10, 2020).
I just want to understand is it expected behavior.
I have two entities.
Budget is an aggregate and my goal is to control limits through the Budget entity. When I call
offSpendingLimit()I expect that row in abudget_spending_limitswould be deleted.The next snippet is working as expected.
But if I leave "leftJoin" then the code just does nothing though "BudgetSpendingLimit" would be force fetched by the second query produced by Doctrine.
As I understood the main difference between those two snippets is how Doctrine fills out the UnitOfWork "originalEntityData" state.
In the first case "originalEntityData" for "Budget" has "spendingLimit" property with the appropriate entity. So when I do flush Doctrine computes changes correctly.
In the second case "originalEntityData" for "Budget" doesn't have the "spendingLimit" property at all.
Is it expected Doctrine behavior? Is there an "easy" way to make code as in the second snippet (without join) work or I need to use join explicitly?