[TASK] Deprecate second controller action argument
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Deprecation-84196-BackendControllerActionsDoNotReceivePreparedResponse.rst
1 .. include:: ../../Includes.txt
2
3 =================================================================================
4 Deprecation: #84196 - Backend controller actions do not receive prepared response
5 =================================================================================
6
7 See :issue:`84196`
8
9 Description
10 ===========
11
12 The second argument to backend and eID controller actions has been deprecated.
13 Controllers should create a response object implementing
14 :php:`Psr\Http\Message\ResponseInterface` on their own instead of relying
15 on a prepared response.
16
17 The signature of controller actions should look like::
18
19 public function myAction(ServerRequestInterface $request): ResponseInterface
20
21
22 Impact
23 ======
24
25 Controllers should typically instantiate one of the three core response classes
26 and return it:
27
28 .. code-block:: php
29
30 public function myAction(ServerRequestInterface $request): ResponseInterface
31 {
32 return new HtmlResponse('content');
33 return new JsonResponse($jsonArray);
34 return new RedirectRespons($url);
35 }
36
37
38 Affected Installations
39 ======================
40
41 Instances with extensions that register backend controllers (eg. modules) or eID
42 may be affected.
43
44 The dynamic scanning for not yet adapted controller actions relies on reflection and
45 costs some CPU cycles. If all affected extensions have been adapted, the feature toggle
46 `simplifiedControllerActionDispatching` should be enabled. This can be managed in
47 the backend Settings module.
48
49
50 Migration
51 =========
52
53 See above code examples for typical controller actions return values and signature.
54
55 .. index:: Backend, PHP-API, NotScanned