-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using EntityRepository.create() or EntityManager.create(Entity) with embeddables a SyntaxError is thrown from the generated hydration function because of an empty if check.
Stack trace
SyntaxError: Unexpected token ')'
at new Function (<anonymous>)
at Function.createFunction (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/utils/Utils.js:612:20)
at ObjectHydrator.getEntityHydrator (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/hydration/ObjectHydrator.js:221:40)
at ObjectHydrator.hydrate (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/hydration/ObjectHydrator.js:23:30)
at EntityFactory.hydrate (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/entity/EntityFactory.js:82:27)
at EntityFactory.create (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/entity/EntityFactory.js:36:14)
at SqlEntityManager.create (/node_modules/.pnpm/@mikro-orm+core@4.5.9_@mikro-orm+sqlite@4.5.9/node_modules/@mikro-orm/core/EntityManager.js:383:40)
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/sylv/mikroorm-nested-embeddables-issue.gitpnpm installpnpm start
Expected behavior
It would create an instance of PluginTestSettings with the provided properties.
Additional context
The generated hydration function from the above reproduction is here https://pastebin.com/uwiU5E3m, lines 22 and 28 are the problem. I could only reproduce it under fairly specific circumstances so I have a feeling I'm doing something wrong but I have absolutely no clue what.
Versions
| Dependency | Version |
|---|---|
| node | 16.6.1 |
| typescript | 4.4.3 |
| mikro-orm | 4.5.9 |
| @mikro-orm/sqlite | 4.5.9 |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working