-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Deprecate StandaloneView getters
Views should be data sinks, but not data sources: In Fluid, RenderingContext is the main state object used to carry rendering related state. As such, StandaloneView should not provide getter methods to retrieve state after it has been set: They could be misused to "park" state, which is a sign of bad architecture since only controllers should keep track, carry and update such state. The patch deprecates offending methods in StandaloveView. Change-Id: Id5c5fc2826b23c258b0f94aedbb0c5e75904e2db Resolves: #98371 Releases: main Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75773 Tested-by: core-ci <typo3@b13.com> Tested-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech>
- Loading branch information
Showing
2 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.../core/Documentation/Changelog/12.0/Deprecation-98371-DeprecatedFluidGetters.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
.. _deprecation-98371-1663524265: | ||
|
||
============================================== | ||
Deprecation: #98371 - Deprecated Fluid getters | ||
============================================== | ||
|
||
See :issue:`98371` | ||
|
||
Description | ||
=========== | ||
|
||
Views in a Model-View-Controller (MVC) construct should be data sinks. | ||
Class :php:`\TYPO3\CMS\Fluid\View\StandaloneView` violates this concept by | ||
providing some :php:`getXY()` methods that allow fetching previously set state. | ||
|
||
The Fluid class :php:`\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext` | ||
is the main object carried around within the rendering chain to keep track | ||
of state. It is the main data object used in view helpers. | ||
|
||
As such, :php:`StandaloneView` should not allow fetching state since it allows | ||
to be misused to park state, which is primarily a controller concern instead. | ||
|
||
To enforce this pattern, the following methods have been marked as deprecated in | ||
TYPO3 core v12 and will be removed in v13: | ||
|
||
* :php:`\TYPO3\CMS\Fluid\View\StandaloneView->getRequest()` | ||
* :php:`\TYPO3\CMS\Fluid\View\StandaloneView->getFormat()` | ||
* :php:`\TYPO3\CMS\Fluid\View\StandaloneView->getTemplatePathAndFilename()` | ||
|
||
|
||
Impact | ||
====== | ||
|
||
Calling one of the above methods triggers a PHP :php:`E_USER_DEPRECATED` level | ||
error. | ||
|
||
|
||
Affected installations | ||
====================== | ||
|
||
Instances with extensions using one of the above methods. | ||
|
||
|
||
Migration | ||
========= | ||
|
||
Do not misuse :php:`StandaloneView` as data source. Typically, controllers | ||
should handle and keep track of state like a PSR-7 Request and set or update | ||
view state. | ||
|
||
|
||
.. index:: Fluid, NotScanned, ext:fluid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters