Skip to content

Eager loading joined relations #11

@xdrew

Description

@xdrew

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions