[TYPO3-mvc] How to: uid IN(1,2,3) and order by rand()

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Aug 10 11:33:58 CEST 2010


Hey,

> - What is the best way to generate a random ordering?
>
> (besides writing the query myself with $query->statement()

there is no way without $query->statement() or fetching all records and 
rand the ObjectStorage. As for $query->statement() I've written some 
little "hack" that eases up the usage of this. In general I use the QOM 
to build all my constraints, then have the storageBackend generate 
queryParts out of it, which returns an array with raw SQL statements. 
Those statements can then be adjusted with some special needs and passed 
to $query-statement().
Unfortunately I can't remember the title of the topic - but a filter for 
"query" on the topics should help you to find my posting.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list