Guest User

Untitled

a guest
Nov 5th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.13 KB | None | 0 0
  1. diff --git a/Classes/Persistence/QueryInterface.php b/Classes/Persistence/QueryInterface.php
  2. index 25f2dad..d89dc1f 100644
  3. --- a/Classes/Persistence/QueryInterface.php
  4. +++ b/Classes/Persistence/QueryInterface.php
  5. @@ -94,6 +94,7 @@ interface Tx_Extbase_Persistence_QueryInterface {
  6.      */
  7.     const ORDER_ASCENDING = 'ASC';
  8.     const ORDER_DESCENDING = 'DESC';
  9. +   const ORDER_RANDOM = 'RAND';
  10.  
  11.     /**
  12.      * An inner join.
  13. diff --git a/Classes/Persistence/Storage/Typo3DbBackend.php b/Classes/Persistence/Storage/Typo3DbBackend.php
  14. index 3610b2d..2635464 100644
  15. --- a/Classes/Persistence/Storage/Typo3DbBackend.php
  16. +++ b/Classes/Persistence/Storage/Typo3DbBackend.php
  17. @@ -873,6 +873,8 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
  18.                 case Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING:
  19.                     $order = 'DESC';
  20.                     break;
  21. +               case Tx_Extbase_Persistence_QueryInterface::ORDER_RANDOM:
  22. +                   $sql['orderings'] = array(' rand()');
  23. +                   continue;
  24. +                   break;
  25.                 default:
  26.                     throw new Tx_Extbase_Persistence_Exception_UnsupportedOrder('Unsupported order encountered.', 1242816074);
  27.             }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment