Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| /** | ||
| * Make easier the creation of JsonResponse from raw json | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What aboutcreateFromStringcreateFromJsonString? or justcreateFromJson
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
4a14137 to6d5a65dComparefabpot commentedAug 16, 2016
👍 |
1 similar comment
nicolas-grekas commentedAug 16, 2016
👍 |
fabpot commentedAug 16, 2016
Thank you@tyx. |
… (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
To make easier construction with raw json. It is a simple addition but having something like :
and
is not very obvious to get the difference without going to read the JsonResponse constructor.