-
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
Restore document proxy state to uninitialized on load exception #10645
Restore document proxy state to uninitialized on load exception #10645
Conversation
6c049ce
to
d472e9a
Compare
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.
Sorry that this PR hasn't been picked up yet. You change looks reasonable.
Can you give a real-world example of what kind of failure could happen here? I wonder if we could build a functional test for this scenario. All this mocking in your test makes the scenario look artificial/hypothetical.
$exception = $this | ||
->getMockBuilder(ConnectionException::class) | ||
->disableOriginalConstructor() | ||
->getMock(); |
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.
Do we really need to mock an exception class?
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.
Well ConnectionException
was the closest exception to the real-world scenario. And as it has a nasty constructor I have decided to mock it. It could be less complicated 👍
And for the example: in my experience we have never encountered this with ORM, but with ODM and native Client-Side Field Level Encryption
we had this issue. As our supervisor consumers catches all exceptions and keep working on messages. On em->flush()
proxies that were not initialized has been flushed to db removing all fields that had no default values.
After I made PR to ODM lib decided to check if the same is possible with ORM also. And theoretically it is possible.
d472e9a
to
58398f5
Compare
Summary
I had an issue in mongodb-odm bundle with proxy left in initialized state on load exception and thought if same could be applied in orm bundle. Test shows same issue is here.
Related
doctrine/mongodb-odm#2521