You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #51538 [HttpFoundation] Support root-level Generator in StreamedJsonResponse (Jeroeny)
This PR was merged into the 6.4 branch.
Discussion
----------
[HttpFoundation] Support root-level Generator in StreamedJsonResponse
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| License | MIT
Currently the `StreamedJsonResponse` only supports streaming nested Generators within an array data structure.
However if a response is a list of items (for example database entities) on the root level, this isn't usable.
I think both usecases can be supported with the change in this PR.
The root level generator doesn't account for additional nested generators yet. I could add that by doing `is_array($item)` and the call the recursive placeholder logic.
Link to first PR that introduced StreamedJsonResponse: symfony/symfony#47709
~~Also something I noticed is I only got intermediate output, when adding a `flush()` call after each item has been echo'd (with a `sleep(1)` after each item to see it output the parts individually).~~ Edit: I see the class' PhpDoc describes this and it's probably expected to be done in userland implementations.
Commits
-------
05e582f1a3 support root-level Generator in StreamedJsonResponse
0 commit comments