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
ChangeSetPersister#mapReturnedValues does not handle OneToOne navigation properties #501
Comments
Is that entity discovered? Also this is not enough as a reproduction, what you described is definitely working, there are tests for this use case. |
@B4nan It might be connected to the PostgreSQL driver (the test is for MySQL). I will see if I can create a minimal reproduction. |
I doubt it has anything to do with drivers, the error is caused by missing method that is added to entity prototype during discovery. So either the variable is holding an entity that was not discovered, or it does not hold entity instance at all. Try putting there Maybe you have this problem? #431 |
No, I used the |
@B4nan let orm: MikroORM<MySqlDriver>;
beforeAll(async () => orm = await initORMMySql());
beforeEach(async () => wipeDatabaseMySql(orm.em)); into let orm: MikroORM<PostgreSqlDriver>;
beforeAll(async () => orm = await initORMPostgreSql());
beforeEach(async () => wipeDatabasePostgreSql(orm.em)); at the top of the file. And it threw the exact same error
|
@B4nan Thank you for fixing this. |
Describe the bug
After persisting an entity, mapReturnedValues assigned the primaryKey value (in my case a string) to the OneToOne (primary: true) property (the type is of course the other Entity class) of the Entity object, thus triggering the set() which mikro-orm assigned and EntityHelper.propagate threw the error below.
Stack trace
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The entities are saved to the database
Additional context
I used PostgreSQL driver and ReflectMetadataProvider.
Maybe a duplicate of #465
Versions
The text was updated successfully, but these errors were encountered: