Bug #99049
closedForwarding with Extbase ForwardResponse to a different Controller only works by assigning ControllerAlias (Followup #91671)
0%
Description
Hi,
I hit the same bug as described in #91671 which was recently closed. I was advised to open a new issue.
I'd argue that it is a core bug, that a forwardResponse to a different controller only works by using the workaround:
$this->request->setControllerAliasToClassNameMapping (
['Controllername' => 'Vendorname\ExtensionName\Controller\ControllernameController']
);
I tried to use all these three variants:
return (new ForwardResponse('actionname'))
->withControllerName('Controllername')
->withExtensionName('ExtensionName');
return (new ForwardResponse('actionname'))
->withControllerName('Vendorname\ExtensionName\Controller\ControllernameController')
->withExtensionName('ExtensionName');
return (new ForwardResponse('actionname'))
->withControllerName(Vendorname\ExtensionName\Controller\ControllernameController::class)
->withExtensionName('ExtensionName');
I'd argue, using any of these last two should work without the need of accessing setControllerAliasToClassNameMapping?
If it is intended behavior, please let me know, then I can issue a PR for the documentation to document the need of using this method when forwarding to another action. The current version of the documentation at https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ExtensionArchitecture/Extbase/Reference/Controller/ActionController.html#forward-to-a-different-controller doesn't address it (btw it contains a small optical issue and uses (('Blog'))
instead of ('Blog')
).
Thanks for your work
Garvin