TYPO3-Documentation / Changelog-To-Doc

1 stars 0 forks source link

[TASK] Deprecate StandaloneView getters #175

Closed TYPO3IncTeam closed 1 year ago

TYPO3IncTeam commented 2 years ago

:information_source: View this commit on Github :busts_in_silhouette: Authored by Christian Kuhn lolli@schwarzbu.ch :heavy_check_mark: Merged by Stefan Bürk stefan@buerk.tech

Commit message

[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

:heavy_plus_sign: Added files

12.0/Deprecation-98371-DeprecatedFluidGetters.rst ```rst .. 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 ```
linawolf commented 1 year ago

Not mentioned in the docs