-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using the discriminatorValue setup for STI entities as described here, I am seeing some strange behaviour when combining with an abstract base (root) class.
The reproduction has 1 base class (Person) and 3 child entities (Chef, Gardener, Teacher).
When I log the metadata I see 2 issues (1 definite, 1 potential):
- The discriminator map is wrong. The abstract root class,
Person, is present when it shouldn't be and theGardenerentity is missing.
discriminatorMap: { chef: 'Chef', person: 'Person', teacher: 'Teacher' }
- The abstract root class,
Person, is marked asabstract: falsein the metadata. I'm not familiar with the internals so this might not be a bug, but it seems wrong given the Person class isabstractand I do not want it included in the generated discriminator map.
This is causing entities to not be entered correctly for the missing child entities.
To Reproduce
Steps to reproduce the behavior:
- Go here to the reproduction
- Run
yarn start:dev- watch the output of metadata found from the entity classes
Expected behavior
Only the non-abstract child entities, Chef, Teacher, and Gardener should exist in the discriminator map, and Person should be excluded.
Versions
| Dependency | Version |
|---|---|
| node | 12.18.3 |
| typescript | 4.0.3 |
| mikro-orm | 4.1.1 |
| your-driver | MySQL |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working