Describe the bug
Fetch an existing entity (A) with an existing 1-1 relation attached (B), where A is the owner with orphanRemoval set. Replace the 1-1 relation (a.some_b = em.create(B, {...})) and the UoW generates three changes:
- Create new B
- Update A setting
a.some_b to undefined
- Delete old B
Since a.some_b is set to undefined, the new B is created but the relation on A is not populated - accessing a.some_b at this point is undefined. Presumably #2 should hold some kind of reference to new B so that the new relation is written.
Expected behavior
Expected a.some_b to be the new instance of B.
Versions
| Dependency |
Version |
| node |
16 |
| typescript |
4.4.4 |
| mikro-orm |
5.0.1 |