-
-
Notifications
You must be signed in to change notification settings - Fork 888
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
Collection of Doctrine Single table inheritance entities #1071
Comments
#1025 can you try the |
@soyuka I am sorry for duplicate. And I am on master already. |
Hmm this patch hasn't been merged back to master yet :|. |
@soyuka I don't seem to see any difference... |
@desmax Can you try to disabled eager loading and try again? api_platform:
eager_loading:
enabled: false Also, can you provide a sample of your entities? |
Even better disable it on the resource:
|
@soyuka Interestingly... that doesn't disabled eager loading on a resource for me. I have to force it through config.yml. That might be a separate issue. |
This is the condition:
Anyway, I need to refactor this fetchEager thing #1035 |
@bwegrzyn disabling eager loading via config does help.
Another thing that bugging me is that array typed |
You must mark each entity with This is probably why it works when eager loading is disabled. Without eager loading, the API Platform will load the main resource, and then issue a separate query for each relation. These queries are standard Doctrine find queries and they load the entire object. When eager loading is enabled, it generates just one query and fetches everything it requires at once (including all relations). If child resources are not marked with |
yes, that is the case. Still, even if I mark all sub classes as Resource - it does not load what it has to.(eager ON) When I mark all sub classes as Resource, fields from them are still not serialized. Plus obviously, my generated documentation is a bit messy and misleading. |
Hmm, I'm not sure. This should have been fixed by #1063. Maybe you can contribute a failing test case? |
@bwegrzyn I got the problem with serialization. your fix p.s. and I don't have to mark sub classes as ApiResource |
@desmax Why do you need a custom normalizer? I'd try not to extend our AbstractNormalizer but instead inject the |
@soyuka I need to translate one field into user's language. Ok I will try injecting. |
Injecting turned out a lot cleaner, thanks. Though I still have issue with eager loading not fetching subclass specific fields. Will try to debug now. |
Might be related to #1069 |
I have an object, that has collection containing different entities, that use Single inheritance.
Problem is that only base fields are fetched, entity specific are null. As I understand its happening because Doctrine partial query is used, but how can I force load all fields for given collection?
The text was updated successfully, but these errors were encountered: