dingo / dingo/api

nested eager loading includes not work

Open
#1,645 1 comment 0 reactions 1 assignee Claimed by @specialtactics View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Laravel|Lumen
| Framework version | 5.8.10
| Package version | 2.2.3
| PHP version | 7.3.3

#### Actual Behaviour

Models:

- Topic —— TopicTransformer `$availableIncludes = ['user'];`
- User;
- Reply —— ReplyTransformer `$availableIncludes = ['user', 'topic'];`

user has many Topics,Tpoic has many replies。when I request `/api/replies?include=topic.user`

only topic eagered,becase those codes :
https://github.com/dingo/api/blob/v2.0.0/src/Transformer/Adapter/Fractal.php#L93-L96

just load topic。

#### Expected Behaviour

`topic.user` will be eagered

#### Steps to Reproduce

There is a public repo: https://github.com/summerblue/larabbs/tree/api

ReplyTransformer:
https://github.com/summerblue/larabbs/blob/api/app/Transformers/ReplyTransformer.php

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.