inserting new entity into metadata storage in Mikro ORM instance #2262
-
Hi, currently I'm working on a project that requires me to use a dynamic database structure with 0 entities given at mikro orm instance init. In the middle of process, I create a table in my database which name, column types, and default value could be vary. I use My question is, how can I insert this new entity files that has just been generated into the running mikro orm connection so I could use it in my EntityManager? I tried to close the connection with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In v5 there is |
Beta Was this translation helpful? Give feedback.
In v5 there is
orm.discoverEntity()
helper method for dynamic registration of new entities, it will basically load the metadata on the fly, no reconnection needed. You can probably do the same in v4 too, but it will be a bit more code (e.g. you will need to create new instance ofMetadataDiscovery
is that is not exposed in v4).