Skip to content
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

Eager loading joined relations #11

Open
xdrew opened this issue Jan 14, 2021 · 0 comments
Open

Eager loading joined relations #11

xdrew opened this issue Jan 14, 2021 · 0 comments

Comments

@xdrew
Copy link

xdrew commented Jan 14, 2021

Hello!

Could you please give a small hint on how the projection should be extended to get joined relations?
For instance:

"hydra:member": [
    {
      "@id": "/api/restaurants/1",
      "@type": "Restaurant",
      "id": 1,
      "deliveryTime": 10,
      "config": {
        "@id": "/api/configs/1",
        "@type": "Config",
        "dynamicWaitingTime": 0
      },
  }
]

By I could only get field config_id instead.
I thought it should be done with following steps:

  1. Add custom query with joins like docs says: https://github.com/pomm-project/ModelManager/blob/master/documentation/model_manager.rst#complex-queries
  2. Hook into normalizer to convert plain joined fields into multidimensional array

But I have no idea how to achieve step 1 with api platform.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant