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
forceObject when defineConfig #4881
Comments
That is a static method, it cannot respect any configuration, it does not have a way to read it. |
I guess we could store the config reference on the entity prototype during discovery, and replace that with the right instance once the entity gets managed, that should cover most of the use cases. |
Dose this affect the multi em instance ? |
How about use the context hook ? the static methdo try to read the config from context that match the current managed em ? |
Well, yes for not managed entities, but don't tell me you would like to have different serialization configs for those.
What's that? You mean the request context? That's an optional feature, I need a universal solution (and yet again, the callback to obtain a context is described in the config).
If an entity is managed, it already has the right EM link attached on it, and that is what would be always preferred. The problem is really just with not managed entities (and I think its safe to say those are not really serialized for most of the times). |
This option is now respected in implicit serialization too, as well as when serializing unpopulated collection items. Closes #4881
Implemented in v6 via 9a4de46 |
This option is now respected in implicit serialization too, as well as when serializing unpopulated collection items. Closes #4881
This option is now respected in implicit serialization too, as well as when serializing unpopulated collection items. Closes #4881
Is your feature request related to a problem? Please describe.
I want to
forceObject: true
when defineConfig, I don't find a way to do this https://mikro-orm.io/docs/serializing#explicit-serialization . seems forceUndefined = skipNull, maybe can add some extra serialize options when defineConfig ?Describe the solution you'd like
global forceObject config
Describe alternatives you've considered
property level option ?
Additional context
The text was updated successfully, but these errors were encountered: