ORM attempts to update multiple, unwanted properties on a populated find or on a populated remove #5288
Jcalcaldev
started this conversation in
General
Replies: 1 comment 8 replies
-
|
That repro is really huge, first step should be to simplify it, now you have 700 loc, get to 100 and things will surely make more sense (at least to me). The way it is now is rather undebuggable :) |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'll do my best to explain what's going on.
For a full reproduction, see below.
On a freshly seeded database, I'm running only this code:
This finds the row, logs it correctly, and THEN throws an error:
Upon further digging, I went to
AbstractSqlDriverand logged the keys on thenativeUpdateManyfunction. This is what I got:So I see that the ORM is trying to update
typeanditemType, which are two enum properties of my tables which should never change, they are explicit discriminator columns from single table inheritance entities.This only happens, as far as I know, if I populate with ['*']. It does not happen with ALL entities in my repo, but with around half of them.
If I log the changeSets, this is what I get:
I think this will be easier to understand in this minimal reproduction test:
https://gist.github.com/Jcalcaldev/7d5937e2ee56e5f54d717eb4fb644019
Keep in mind, in the test, the error is not fired upon a
find, but upon a removal. I found this is another way to reproduce the same error by coincidence.I also noticed that if I remove the
em.clear()line on thebeforeEachblock, the test goes through as intended.The entities' structure is a bit bloated, but I cleaned it the best I could, while preserving everything that I think might be important.
Beta Was this translation helpful? Give feedback.
All reactions