[TASK] Doctrine: Migrate ext beuser viewhelpers 91/48491/5
authorXavier Ley <xavierley@gmail.com>
Tue, 7 Jun 2016 17:16:47 +0000 (19:16 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 9 Jun 2016 07:43:25 +0000 (09:43 +0200)
Resolves: #76507
Releases: master
Change-Id: Ib8a3cda5e691036ed5836aaabc77ced681a860d7
Reviewed-on: https://review.typo3.org/48491
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/beuser/Classes/ViewHelpers/Display/PagesViewHelper.php
typo3/sysext/beuser/Classes/ViewHelpers/Display/SysFileMountsViewHelper.php
typo3/sysext/beuser/Classes/ViewHelpers/Display/SysLanguageViewHelper.php

index db3e39d..61c73ef 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 
@@ -62,16 +64,25 @@ class PagesViewHelper extends AbstractViewHelper
         }
 
         $content = '';
-        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-            'uid, title',
-            'pages',
-            'uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($uids) . ')',
-            'uid ASC'
-        );
-        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
+        $queryBuilder->getRestrictions()->removeAll();
+
+        $res = $queryBuilder
+            ->select('uid', 'title')
+            ->from('pages')
+            ->where(
+                $queryBuilder->expr()->in(
+                    'uid',
+                    GeneralUtility::intExplode(',', $uids)
+                )
+            )
+            ->orderBy('uid', 'ASC')
+            ->execute();
+
+        while ($row = $res->fetch()) {
             $content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
         }
-        $GLOBALS['TYPO3_DB']->sql_free_result($res);
         return '<ul>' . $content . '</ul>';
     }
 }
index e56dbbc..cc7a059 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 
@@ -62,16 +64,25 @@ class SysFileMountsViewHelper extends AbstractViewHelper
         }
 
         $content = '';
-        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-            'uid, title',
-            'sys_filemounts',
-            'uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($uids) . ')',
-            'title ASC'
-        );
-        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_filemounts');
+        $queryBuilder->getRestrictions()->removeAll();
+
+        $res = $queryBuilder
+            ->select('uid', 'title')
+            ->from('sys_filemounts')
+            ->where(
+                $queryBuilder->expr()->in(
+                    'uid',
+                    GeneralUtility::intExplode(',', $uids)
+                )
+            )
+            ->orderBy('title', 'ASC')
+            ->execute();
+
+        while ($row = $res->fetch()) {
             $content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
         }
-        $GLOBALS['TYPO3_DB']->sql_free_result($res);
         return '<ul>' . $content . '</ul>';
     }
 }
index befbbb1..688142a 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 
@@ -62,16 +64,25 @@ class SysLanguageViewHelper extends AbstractViewHelper
         }
 
         $content = '';
-        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-            'uid, title, flag',
-            'sys_language',
-            'uid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($uids) . ')',
-            'title ASC'
-        );
-        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_filemounts');
+        $queryBuilder->getRestrictions()->removeAll();
+
+        $res = $queryBuilder
+            ->select('uid', 'title', 'flag')
+            ->from('sys_language')
+            ->where(
+                $queryBuilder->expr()->in(
+                    'uid',
+                    GeneralUtility::intExplode(',', $uids)
+                )
+            )
+            ->orderBy('title', 'ASC')
+            ->execute();
+
+        while ($row = $res->fetch()) {
             $content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
         }
-        $GLOBALS['TYPO3_DB']->sql_free_result($res);
         return '<ul>' . $content . '</ul>';
     }
 }