yii2
yii2 copied to clipboard
Action after run result
Q | A |
---|---|
Is bugfix? | ✔️ |
New feature? | ✔️ |
Breaks BC? | ✔️ |
Fixed issues | #13484 |
The \yii\base\Action::afterRun()
documentation states:
"You may override this method to do post-processing work for the action run"
Currently post-processing is not possible since the $result
is not passed to the afterRun()
function in the \yii\base\Action::runWithParams()
function.
This was discussed earlier, but since Yii 2.1 is cancelled I would like to re-submit this feature.
ToDo:
- [x] Implementation
- [ ] Documentation/Changelog/Upgrade steps
- [ ] Unit tests
PR Summary
-
Updated
afterRun()
method inframework/base/Action.php
- Modified the method call to pass the
$result
parameter - Added a new parameter
$result
to the method - Included a proper return statement for the method
- Modified the method call to pass the
@samdark @bizley What do you think?
This is a big BC break, not sure if we want to change it like that.
@rhertogh do you have a use-case for it or is it based mainly on the contradiction of current code with phpdoc?
@samdark I've an actual use case for it where I need to run some code in the beforeRun
(based on the arguments) and in the afterRun
(based on the result).
I thought these functions would solve my needs but then I ran into the issue that the the functions don't behave as expected.
@bizley Something for Yii 2.2?
@rhertogh maybe. I've posted there in a discussion.