Bug #100671
openResponses returned from initializeAction methods are not processed
0%
Description
While upgrading Powermail to version 12 we noticed that forwarding inside an initializeAction method does not work (anymore).
With TYPO3 11 (and now required in 12) actions require a ResponseInterface to be returned. Now if we want to forward/redirect ahead of an action, for guarding purposes, we thought that returning a Response inside initialize{action}Action would yield that result.
It doesn't, and so we don't have a way to respond differently ahead of an action being called. Or at least, as simple as it was before.
We need this functionality because we are validating that arguments are sent against the correct form, but due to ActionController not stopping to process a request when any Response has been returned from an initializeAction method, it continues on with the actual action, causing validation errors and other wrong behaviour.
Is this a bug, or what is the best approach in version 12 to forward before an action is being called?
Updated by Christian Kuhn over 1 year ago
Mmmh. I'm not entirely sure, but I'd argue that initialize*() actions in extbase are not supposed to return a response, but void.
Their idea is to contain action set up, and should most likely not be abused for validation purposes.
I don't insist on this view (at first thought), but maybe it's better to have a first action that does your custom validation, which returns a redirect response on failure, and to forward to another action otherwise? What do you think?
Updated by Christian Kuhn over 1 year ago
- Status changed from New to Needs Feedback