spatie / fractalistic

A framework agnostic, developer friendly wrapper around Fractal
https://freek.dev/644-a-developer-friendly-wrapper-around-fractal
MIT License
382 stars 32 forks source link

include depth #16

Closed ronnievisser closed 7 years ago

ronnievisser commented 7 years ago

Hi,

I was wondering if it's possible to set and include depth. I have an API with might return a large collection of data. I know I can paginate but that's just not sufficient enough.

I handle sports data statistics so let's say I have a paginated response with 25 seasons on a page. the season entity has and option to include fixtures which on it's turn has the possibility to include a lineup, events, stats etc.

you can image that, since a season has around 380 fixtures, the response can be big. especially when including more related includes.

so I was wondering if it's possible to set a max depth to set it for example to 1 so that on a given endpoint only fixtures can be included and all other related includes are not handled.

or would there be any other solution to achieve such?

freekmurze commented 7 years ago

Hi, this question regards Fractal itself. Please open up an issue with this question at their issue tracker.

ronnievisser commented 7 years ago

No it doesn't.

Fractal has a setRecursionLimit on the manager instance but I cannot use it with your package.

freekmurze commented 7 years ago

I've added a limitRecursion function in v2.1.0 of the package. Let me know if this works for you.