Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Support root-level Generator in StreamedJsonResponse#51538

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.4fromJeroeny:streamjson
Oct 1, 2023

Conversation

@Jeroeny
Copy link
Contributor

@JeroenyJeroeny commentedSep 2, 2023
edited
Loading

QA
Branch?6.4
Bug fix?no
New feature?yes
Deprecations?no
LicenseMIT

Currently theStreamedJsonResponse 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 doingis_array($item) and the call the recursive placeholder logic.

Link to first PR that introduced StreamedJsonResponse:#47709

Also something I noticed is I only got intermediate output, when adding aflush() call after each item has been echo'd (with asleep(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.

SonyPradana reacted with thumbs up emoji
@derrabus
Copy link
Member

Thank you. Please be aware that we never merge new features without any tests.

@Jeroeny
Copy link
ContributorAuthor

@derrabus Thanks for the hint, added tests.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR. Please add a line about this to the changelog of the component.

@Jeroeny
Copy link
ContributorAuthor

Added the changelog entry

@fabpot
Copy link
Member

Thank you@Jeroeny.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

5 participants

@Jeroeny@derrabus@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp