-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Resolved a bug where a soft-deleted object isn't remove from the ObjectManager #2930
base: main
Are you sure you want to change the base?
Resolved a bug where a soft-deleted object isn't remove from the ObjectManager #2930
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2930 +/- ##
==========================================
+ Coverage 78.51% 78.53% +0.01%
==========================================
Files 168 168
Lines 8782 8790 +8
==========================================
+ Hits 6895 6903 +8
Misses 1887 1887 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@phansys it'd be nice if the tests could be run on new commits. Also, I believe the CHANGELOG will need to be something you commit, as I don't have the target version. |
@@ -129,10 +137,27 @@ public function onFlush(EventArgs $args) | |||
$postSoftDeleteEventArgs | |||
); | |||
} | |||
|
|||
$this->softDeletedObjects[] = $object; |
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.
More than a suggestion, this is a question or a request for analysis.
Given storing the list of deleted objects in this array could lead to high memory consumption, do you evaluated a way to mitigate this by using the object references (like the ones produced by spl_object_id()
, spl_object_hash()
, or a combination of the model class and its id)?
I don' t know if this can produce better results, but I think this is a consideration we should take into account.
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.
Being that these objects are unset (cleared from memory) postFlush
, I really don't see it as much of a concern - certainly not enough to introduce spl_object_id
complexity and the potential to expose bugs through that.
Co-authored-by: Javier Spagnoletti <phansys@gmail.com>
Co-authored-by: Javier Spagnoletti <phansys@gmail.com>
Co-authored-by: Javier Spagnoletti <phansys@gmail.com>
Currently, after you remove an entity, it's still queryable by the pk, as it's cached in the
ObjectManager
. This PR fixes this bug by removing itpostFlush
. See test for more details.