-
-
Notifications
You must be signed in to change notification settings - Fork 105
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add handling of result from action* and handle* #228
base: master
Are you sure you want to change the base?
WIP: Add handling of result from action* and handle* #228
Conversation
Force-push to amend commit with bad indentation style |
Perhaps it would be better to discuss it in a forum where it will find more people. |
It is already posted at forum, but there were no reactions for days so I suggested PR to don't lost it in forum history https://forum.nette.org/en/32437-response-returning-from-presenter |
Apparently this is a thing no one needs. 🤔 |
Not really needed, just makes code cleaner imho. Methods like |
I agree that no one needs this, my point is however, that this might make sending response less driven by exeptions. My main motivation is to offer a way to avoid this (example copied from forum)
by using this:
|
I understand. |
e17599b
to
67f45fb
Compare
7e42997
to
f7df426
Compare
I'm taking back statement about static analysis, phpstan understands it |
0e26720
to
e65cf05
Compare
7fe78c1
to
8f1bb54
Compare
e3d05b3
to
929a242
Compare
426e735
to
c19ebdc
Compare
2b9da37
to
30d90f4
Compare
bf86204
to
c91f90a
Compare
57bd587
to
e908315
Compare
c5ecbda
to
ecb200c
Compare
This PR adds possibility to presenters action* methods and components handle* methods to directly return response.
If they return scalar/array value, it is wrapped into typical JsonResponse (this response creation could and probably should be done via an additional service so the functionality is not coupled in the Presenter.
Right now, this PR is more of an API proposal to reduce coupling of Component handlers dependency on their presenter. More verbose description can be found on the forum.
As I said, I'm not entirely happy about storing the handle result in a property but it is about the best I could come up with while not changing public API of the system too much.
TODO: