Project

General

Profile

Actions

Bug #99049

closed

Forwarding with Extbase ForwardResponse to a different Controller only works by assigning ControllerAlias (Followup #91671)

Added by Garvin Hicking about 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2022-11-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #101824: RedirectReponse to another Controller missing controllerObjectNameClosed2023-09-01

Actions
Actions

Also available in: Atom PDF