mikro-orm: [bug] OneToOne inverse relationship not made
Looking at the database, the issue seems to be that dog.person isn’t populated, but person.dog is.
https://github.com/lookfirst/mikro-example/blob/master/test/dog.spec.ts#L51
[query] begin
[query] insert into `Dog` default values [took 1 ms]
[query] insert into `Person` (`dog`, `email`, `id`) values (?, ?, ?) [took 1 ms]
[query] commit
[query] select `e0`.* from `Dog` as `e0` where `e0`.`id` = ? limit ? [took 1 ms]
TypeError: Cannot read property 'init' of null
at Context.<anonymous> (test/dog.spec.ts:61:42)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (29 by maintainers)
Ah, nevermind… I know what is going wrong… a prior query is pulling out the person. Had to add
{refresh: true}.