[TYPO3-english] How to sort results from $query->execute() ?

Xavier Perseguers xavier at typo3.org
Sat Feb 22 21:19:37 CET 2014


Hi Alexander,

> how can I sort the results from $ query-> execute ()? Unfortunately, I
> can't realize the sorting, that I wish, with the standard options from
> extbase, Has anyone this  realized?
> $ query-> execute () returns an Object of Klassе TYPO3 \ CMS \ Extbase \
> Persistence \ Generic \ Query Result.

Convert to array using ->toArray() and then iterate as you want (or
iterate over the QueryResult, and do your own logic to construct an
array of object).

The array you build will be compatible with Fluid, but will not with its
paginator. As long as you don't use it, it should be fine.

Cheers

-- 
Xavier Perseguers
TYPO3 CMS Team Member

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org



More information about the TYPO3-english mailing list