MikroORM never calls entity constructor, so you are free to use it as you wish.
The constructor will be called only when you instantiate the class yourself via
so it is a handy place to require your data when creating new entity.
For example following
Book entity definition will always require to set
publisher will be optional:
If we want to use native private properties inside entities, the default approach of
how MikroORM creates entity instances via
Object.create() is not viable (more about this
in the issue). To force usage of entity
constructors, we can use