[!!!][TASK] Remove deprecated functionality in RootlineUtility 32/59332/2
authorBenni Mack <benni@typo3.org>
Fri, 4 Jan 2019 19:36:20 +0000 (20:36 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 5 Jan 2019 17:13:32 +0000 (18:13 +0100)
The constructor does not allow PageRepository anymore, but the new
Context object only (or null, as it is an optional argument).

Resolves: #87331
Releases: master
Change-Id: I4d103aee03b1b30ceab6f033ccc58b1af0626157
Reviewed-on: https://review.typo3.org/59332
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Utility/RootlineUtility.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst

index f1a8814..b67142d 100644 (file)
@@ -101,11 +101,11 @@ class RootlineUtility
     ];
 
     /**
-     * Rootline Context
+     * Database Query Object
      *
      * @var PageRepository
      */
-    protected $pageContext;
+    protected $pageRepository;
 
     /**
      * Query context
@@ -127,23 +127,17 @@ class RootlineUtility
     /**
      * @param int $uid
      * @param string $mountPointParameter
-     * @param PageRepository|Context $context - @deprecated PageRepository is used until TYPO3 v9.4, but now the third parameter should be a Context object
+     * @param Context $context
      * @throws MountPointsDisabledException
      */
     public function __construct($uid, $mountPointParameter = '', $context = null)
     {
         $this->mountPointParameter = trim($mountPointParameter);
-        if ($context instanceof PageRepository) {
-            trigger_error('Calling RootlineUtility with PageRepository as third parameter will be unsupported with TYPO3 v10.0. Use a Context object directly.', E_USER_DEPRECATED);
-            $this->pageContext = $context;
-            $this->context = GeneralUtility::makeInstance(Context::class);
-        } else {
-            if (!($context instanceof Context)) {
-                $context = GeneralUtility::makeInstance(Context::class);
-            }
-            $this->context = $context;
-            $this->pageContext = GeneralUtility::makeInstance(PageRepository::class, $context);
+        if (!($context instanceof Context)) {
+            $context = GeneralUtility::makeInstance(Context::class);
         }
+        $this->context = $context;
+        $this->pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
 
         $this->languageUid = $this->context->getPropertyFromAspect('language', 'id', 0);
         $this->workspaceUid = $this->context->getPropertyFromAspect('workspace', 'id', 0);
@@ -261,11 +255,11 @@ class RootlineUtility
             if (empty($row)) {
                 throw new PageNotFoundException('Could not fetch page data for uid ' . $uid . '.', 1343589451);
             }
-            $this->pageContext->versionOL('pages', $row, false, true);
-            $this->pageContext->fixVersioningPid('pages', $row);
+            $this->pageRepository->versionOL('pages', $row, false, true);
+            $this->pageRepository->fixVersioningPid('pages', $row);
             if (is_array($row)) {
                 if ($this->languageUid > 0) {
-                    $row = $this->pageContext->getPageOverlay($row, $this->languageUid);
+                    $row = $this->pageRepository->getPageOverlay($row, $this->languageUid);
                 }
                 $row = $this->enrichWithRelationFields($row['_PAGES_OVERLAY_UID'] ??  $uid, $row);
                 self::$pageRecordCache[$currentCacheIdentifier] = $row;
index bb632f4..5397cb0 100644 (file)
@@ -427,6 +427,7 @@ The following methods changed signature according to previous deprecations in v9
 * :php:`TYPO3\CMS\Core\Utility\GeneralUtility->explodeUrl2Array()` - Second argument dropped
 * :php:`TYPO3\CMS\Core\Utility\GeneralUtility->getUrl()` - Third argument must be an array of arrays if given
 * :php:`TYPO3\CMS\Core\Utility\GeneralUtility->mkdir_deep()` - Second argument dropped
+* :php:`TYPO3\CMS\Core\Utility\RootlineUtility->__construct()` - Third optional argument now has to be Context object or null
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->getRawRecord()` - Fourth argument dropped
 * :php:`TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->__construct()` - Fourth argument unused
 * :php:`TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->calculateLinkVars()` - First argument mandatory