Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Random sorting of QueryResults in TYPO3 6.2
<?php
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
class RandomQueryResult extends QueryResult {
/**
* Keeps track of, if queryResult has been shuffled
*/
protected $shuffled = FALSE;
/**
* Loads the objects this QueryResult is supposed to hold
*
* @return void
*/
protected function initialize() {
parent::initialize();
if (!$this->shuffled) {
shuffle($this->queryResult);
$this->shuffled = TRUE;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.