Thank you both for the information you provided me.
I just realized there's now random order in extbase for my purposes (I
need to order a bunch of elements, not only one), so the only thing it
occurs to me is to shuffle the query result in PHP.
For that purpose I would do:
$array = $query-
Hi Sergio
Besides the information you already got, check out this issue:
http://forge.typo3.org/issues/14026
Best regards,
Lorenz
Am 14.01.2013 16:37, schrieb Sergio:
Hi list,
I would like to order a query by random. Is it possible nowadays in Extbase?
I saw this thread:
http://lists.typo3.
How about this workaround (but it needs 2 queries for the result):
createQuery()->execute()->count();
$row_number = mt_rand(0, max(0, ($rows - 1)));
return
$this->createQuery()->setOffset($row_number)->setLimit(1)->execute();
}
}
?>
Am 14.01.2013 17:49, schrieb Sergio:
Hi
Hi Paul,
yes, I know, but it's not possible for now to do in extbase:
$query->setOrderings(array(
'RAND()' => Tx_Extbase_Persistence_Query::ORDER_ASCENDING
));
:-(
___
TYPO3-english mailing list
TYPO3-english@lists.typo3.org
http://lists.typo3.org/c
Hi Sergio,
the
RAND()
statement is the correct way for SQL. It is also the best way to get an random
order in terms of speed, because you don't have to order the result afterwards
with PHP.
Greets,
Paul
Am 14.01.2013 16:37, schrieb Sergio:
Hi list,
I would like to order a query by random
Hi list,
I would like to order a query by random. Is it possible nowadays in Extbase?
I saw this thread:
http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-July/005870.html
But I don't know if there's a simpler way to achieve that.
Thanks,
Sergio