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] Add named constructor on JsonResponse#19552

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

Conversation

@tyx
Copy link
Contributor

@tyxtyx commentedAug 5, 2016

QA
Branch?"master"
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

To make easier construction with raw json. It is a simple addition but having something like :

returnnewJsonResponse($content, Response::HTTP_OK, [],true);

and

returnnewJsonResponse($content, Response::HTTP_OK, []);

is not very obvious to get the difference without going to read the JsonResponse constructor.

chalasr reacted with thumbs up emoji

/**
* Make easier the creation of JsonResponse from raw json
*/
Copy link
Contributor

@ro0NLro0NLAug 6, 2016
edited
Loading

Choose a reason for hiding this comment

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

What aboutcreateFromStringcreateFromJsonString? or justcreateFromJson

ogizanagi reacted with thumbs up emoji
Copy link
Contributor

@ro0NLro0NLAug 7, 2016
edited
Loading

Choose a reason for hiding this comment

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

BtwcreateFromString somewhat implies a callback (JSONP) is parsed as well.. so you know ;-)

Edit: i guess we dont wanna go that way.

Copy link
ContributorAuthor

@tyxtyxAug 8, 2016
edited
Loading

Choose a reason for hiding this comment

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

No problem to switch tocreateFromJsonString. I'm used to remove thecreate prefix but if everyone prefer with it, I'm ok !

To make easier construction with raw json
@tyxtyxforce-pushed thefeature/named-constructor-json-string branch from4a14137 to6d5a65dCompareAugust 8, 2016 08:00
@fabpot
Copy link
Member

👍

1 similar comment
@nicolas-grekas
Copy link
Member

👍

@fabpot
Copy link
Member

Thank you@tyx.

tyx reacted with hooray emoji

@fabpotfabpot merged commit6d5a65d intosymfony:masterAug 16, 2016
fabpot added a commit that referenced this pull requestAug 16, 2016
… (tyx)This PR was merged into the 3.2-dev branch.Discussion----------[HttpFoundation] Add named constructor on JsonResponse| Q             | A| ------------- | ---| Branch?       | "master"| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |To make easier construction with raw json. It is a simple addition but having something like :```phpreturn new JsonResponse($content, Response::HTTP_OK, [], true);```and```phpreturn new JsonResponse($content, Response::HTTP_OK, []);```is not very obvious to get the difference without going to read the JsonResponse constructor.Commits-------6d5a65d Add named constructor on JsonResponse
@tyxtyx deleted the feature/named-constructor-json-string branchAugust 16, 2016 15:50
@fabpotfabpot mentioned this pull requestOct 27, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@tyx@fabpot@nicolas-grekas@ro0NL@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp