-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
UnitOfWork::clear() misses $eagerLoadingEntities #7869
Conversation
|
I'm not sure why this happens either... Locally, I'm not familiar with
that it only reports issues on the line(s) modified by the PR. And due to the surrounding lines, there is not much I can do to fix this. |
Maybe you could try aligning all equal signs, including in the surrounding lines? |
Let's try this! |
Hey! That actually worked! :) |
Original commit: d070fc6 |
The commit above contains a similar change for |
I have unfortunately no idea. For sure anything that contains a reference to an entity must be cleared, hence this PR, for the rest I'm not the right person to ask ;) |
Let's wait for feedback from contributors that know the UOW better than I do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenMorel thanks for the patch. The fix is 100% valid but we need a test to be able to get it merged 👍
@lcobucci Adding a test does not look like a trivial task, as there is no setter/getter for Suggestions:
|
Suggestion: You could use an EntityManager in a functional test to setup eagerloading entities and test the clear-method of the UOW. |
Otherwise, getClassMetadata would be triggered more times
Test case added |
@ostrolucky Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an issue I found when i was working on ephemeral unit of work support. It also helps on freeing resources as eager loaded entities hang there forever. Patch on its own is great.
*/ | ||
class GH7869Test extends OrmTestCase | ||
{ | ||
public function testDQLDeferredEagerLoad() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to rename test case 😞 Let me know if I Should create new PR with just this change
AFAICS, eager loading entities should be cleared as well when the UnitOfWork is cleared.
Actually, this is already the case on
master
!