You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After some debugging, I've found that finalize method in the QueryBuilderHelper adds entity_a_id as a returning field, cause it has default value, I guess that makes sense. But when the returned value is mapped the original entityA ref (that has both id and envID) replaced with incorrect one (that has only id, no env id), it happens cause in the mapReturnedValuesentityA is set to entity_a_id that is returned from the DB, but it should be a composite value (array of entity_a_id and envID).
Not sure what's the best solution here, probably ignore nullable + composite key references during mapReturnedValues?
Describe the bug
ORM generates incorrect
Ref
for nullable and composite key references.Here's an example:
when I try to upsert entities like below, I get an error
ValidationError: Value for EntityB.envID is required, 'undefined' found
.After some debugging, I've found that finalize method in the
QueryBuilderHelper
addsentity_a_id
as a returning field, cause it has default value, I guess that makes sense. But when the returned value is mapped the originalentityA
ref (that has bothid
andenvID
) replaced with incorrect one (that has only id, no env id), it happens cause in themapReturnedValues
entityA
is set toentity_a_id
that is returned from the DB, but it should be a composite value (array ofentity_a_id
andenvID
).Not sure what's the best solution here, probably ignore nullable + composite key references during
mapReturnedValues
?Reproduction
see above
What driver are you using?
@mikro-orm/postgresql
MikroORM version
5.9.4
Node.js version
v16.19.0
Operating system
macOS
Validations
The text was updated successfully, but these errors were encountered: