Feature: #92815 - Introduce ForwardResponse for extbase
See forge#92815
Description
Since TYPO3 11.0, extbase controller actions can and should return PSR-7 compatible response objects.
To allow the initiation of forwarding to another controller action class \TYPO3\
has been introduced.
Minimal example:
<?php
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
class FooController extends ActionController
{
public function listAction(): ResponseInterface
{
// do something
return new ForwardResponse('show');
}
}
Copied!
Example that shows the full api:
<?php
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
class FooController extends ActionController
{
public function listAction(): ResponseInterface
{
// do something
return (new ForwardResponse('show'))
->withControllerName('Bar')
->withExtensionName('Baz')
->withArguments(['foo' => 'bar'])
;
}
}
Copied!
Impact
Class \TYPO3\
allows users to initiate forwarding to other controller actions with a PSR-7 compatible response object.