1.. include:: ../../Includes.txt 2 3======================================================= 4Feature: #92815 - Introduce ForwardResponse for extbase 5======================================================= 6 7See :issue:`92815` 8 9Description 10=========== 11 12Since TYPO3 11.0, extbase controller actions can and should return PSR-7 compatible response objects. 13To allow the initiation of forwarding to another controller action class :php:`TYPO3\CMS\Extbase\Http\ForwardResponse` has been introduced. 14 15Minimal example: 16 17.. code-block:: php 18 19 <?php 20 21 use Psr\Http\Message\ResponseInterface; 22 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; 23 use TYPO3\CMS\Extbase\Http\ForwardResponse; 24 25 class FooController extends ActionController 26 { 27 public function listAction(): ResponseInterface 28 { 29 // do something 30 31 return new ForwardResponse('show'); 32 } 33 } 34 35 36Example that shows the full api: 37 38.. code-block:: php 39 40 <?php 41 42 use Psr\Http\Message\ResponseInterface; 43 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; 44 use TYPO3\CMS\Extbase\Http\ForwardResponse; 45 46 class FooController extends ActionController 47 { 48 public function listAction(): ResponseInterface 49 { 50 // do something 51 52 return (new ForwardResponse('show')) 53 ->withControllerName('Bar') 54 ->withExtensionName('Baz') 55 ->withArguments(['foo' => 'bar']) 56 ; 57 } 58 } 59 60Impact 61====== 62 63Class :php:`TYPO3\CMS\Extbase\Http\ForwardResponse` allows users to initiate forwarding to other controller actions with a PSR-7 compatible response object. 64 65.. index:: PHP-API, ext:extbase 66