-
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
fix: OneToManyPersister does not take custom identifier types into account for orphan removal #10747
fix: OneToManyPersister does not take custom identifier types into account for orphan removal #10747
Conversation
Maybe the functional tests named |
Yeah I would've just placed this next to the existing ManyToManyPersister test, so good I asked, thanks :-) |
Okay I've made a unit test that validates this behavior ( tested on mysql, and it fails as expected ), adding Ramsey as a vendor obviously doesn't sense, but I could use a little help with ideas as of how to go about testing this via another route :-). |
00de8f5
to
97ebed4
Compare
@greg0ire think we are good now for a review :-) |
Also fixes #9745 |
There are PHPStan issues. See https://www.doctrine-project.org/contribute/#running-checks-before-pushing for how to run checks before pushing. |
I ran this earlier locally, and again after your comment ( I did mess up phpcs, and psalm apparently ).
PHPCS issue is fixed, inconsistency is fixed, but I cannot grasp how the PHPStan errors from the report are related to my PR, could you please double check if I am a dummy? As for the psalm error, it seems related to the underlying existing documentation which already supports |
Ah I didn't check myself, maybe it's related to a recent release, let me check. |
Some of it is definitely related to a recent release, I'll fix it. |
Thanks let me know when I should rebase, and if I'd have to do anything else in regards to the psalm error :-), and thanks for your prompt feedback! |
Ok so you can ignore the second Psalm error, and focus on the 2 other ones, they must be caused by this. See #10754 for the other errors. |
You'd want me to just rebase on top of that branch or wait until it merges? |
@greg0ire as I said I am really not familiar with all the ins and outs of psalm, I ran into these baseline errors, after some searching around I ran the
I updated the psalm baseline and committed this, assuming that's what is supposed to happen at this stage. As far as I understand it's a sort of "ignore stuff from here", and the errors triggered seem related. I might be misunderstanding this so if I need to do something else please give me a little more guidance, psalm noob :-). I could imagine this might have more changes than it should, but I am not familiar as of how to treat this file. |
You will need to wait for #10754 to be merged. The baseline is a file that allows you to ignore errors. Setting Psalm to a very high level generates many errors, too many for us, so we baselined many of them. That way, new code is held to a very high standard, and we can reduce the baseline progressively and make old code also comply with high standards. In your case, it's OK to remove stuff from the baseline if your changes somehow fix them, or make them no longer relevant. |
Assumed that was the case, thanks for taking the time to explain :-) |
edb7ab2
to
06a4004
Compare
f550344
to
88097ac
Compare
e09aa24
to
3895488
Compare
phpstan happy, psalm happy, phpcs happy, I hope we are finally good now 🙏 |
Let me know if I still need to squash these commits, sorry about the going back and forth ❤️ |
No worries. I think there should be 2 commits:
That's because right now, I don't think there is a relation between the 2 changes. Let me know if you need help going from 3 to 2 commits. |
3f63dd6
to
cd13eb9
Compare
@greg0ire okay that's done as well 😓 |
The code looks good, I think. The commit message should be improved, so you should probably read https://www.doctrine-project.org/contribute/#crafting-meaningful-commit-messages Specifically, the commit message only mentions the problem you're addressing, but does not detail what happens (do you have an error message? Or nothing happens. Also, it does not explain why why the issue exists, what you are doing in this PR, and why that fixes the issue. Maybe what's happening is that at some point, the ORM is comparing objects with their representation in the database, when it should really convert the objects first, is that it? |
As was in the example I've given before with the gnarly ramsey/uuid implementation ( for the test case ), basically what happens is a custom doctrine type of Uuid object is converted to string by simply casting, resulting in a hex |
… for orphan removal. In my case a custom doctrine type of Uuid object is converted to string by simply casting it, resulting in a hex DELETE FROM x WHERE id = ? query, whilst it should've been converted along the way to it's binary representation. This leads to no deletions being made at all as you would expect making use of doctrine custom type's as an identifier. This commit fixes usage of ramsey/uuid or symfony/uid as custom id types when making use of orphan removal.
cd13eb9
to
3c0d140
Compare
Rewrote last commit's message to address this. |
And #10075 just was ignored, thanks guys |
Thanks @wtfzdotnet ! @norkunas , that's unfortunate your PR got ignored, but I don't see why you feel entitled to complain about it. I mean, we're not paid to review all incoming PRs, are we? |
I don't complain. I stated a fact, and then thanked. At least after so long somebody gave a duck and completed this |
If you don't complain then we're cool 🙂 We in the team get drowned daily in a shitload of notifications, and it's indeed cool that people don't get discouraged by this and stuff ends up getting fixed. So thank you both for caring! |
I've taken a look at the test suite, but I am kind of mind-boggled as of where to begin, could you please point me in the right direction to make sure this change gets merged? (I'll tidy up this PR later when it's done)
Thanks! :-)