[TASK] Doctrine: migrate ext:backend/Controller/LoginController 57/47757/5
authorJonathan IROULIN <joniroutypo3@gmail.com>
Mon, 18 Apr 2016 16:05:08 +0000 (18:05 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 18 Apr 2016 17:39:26 +0000 (19:39 +0200)
Resolves: #75749
Releases: master
Change-Id: I1de410ed558c80647a5288ecf3bef78bb4497ad0
Reviewed-on: https://review.typo3.org/47757
Reviewed-by: Christoph Kratz <ckr@rtp.ch>
Tested-by: Christoph Kratz <ckr@rtp.ch>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/LoginController.php

index a0b5b72..36c8e60 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Exception;
 use TYPO3\CMS\Backend\LoginProvider\LoginProviderInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\FormProtection\BackendFormProtection;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Localization\Locales;
@@ -362,8 +363,15 @@ class LoginController
     protected function getSystemNews()
     {
         $systemNewsTable = 'sys_news';
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
+            ->getQueryBuilderForTable($systemNewsTable);
         $systemNews = array();
-        $systemNewsRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('title, content, crdate', $systemNewsTable, '1=1' . BackendUtility::BEenableFields($systemNewsTable) . BackendUtility::deleteClause($systemNewsTable), '', 'crdate DESC');
+        $systemNewsRecords = $queryBuilder
+            ->select('title', 'content', 'crdate')
+            ->from($systemNewsTable)
+            ->orderBy('crdate', 'DESC')
+            ->execute()
+            ->fetchAll();
         foreach ($systemNewsRecords as $systemNewsRecord) {
             $systemNews[] = array(
                 'date' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $systemNewsRecord['crdate']),
@@ -515,16 +523,6 @@ class LoginController
     }
 
     /**
-     * Returns the database connection
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
-    /**
      * Returns an instance of DocumentTemplate
      *
      * @return \TYPO3\CMS\Backend\Template\DocumentTemplate