typo3 query: ORDER BY RAND()

I needed a query that returns 5 random items. My solution: //fetch 5 IDs from the mm table $idArr = $GLOBALS[‘TYPO3_DB’]->exec_SELECTgetRows( ‘uid_local’, ‘tx_something_user_userarticles_article_mm’,”, ”, ‘RAND()’, ‘5’ ); $ids = array(); //save the IDs to $ids foreach($idArr as $k => $v){ […]

Typo3 extbase: show repository query

If I want to look at the generated query, I have to do this: $queryParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(‘TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser’); \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($queryParser->parseQuery($query)); That doesn’t show the query itself, but at least all parts and the information in tables, fields and where are quite helpful. […]