Permalink
Browse files

BUGFIX Restfulserver should use the correct way when sorting SS_Lists

  • Loading branch information...
1 parent a642a29 commit e22eaec204eaa797c2b4a22f91a0b4fb8b671ebe @stojg stojg committed with sminnee Dec 8, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 api/RestfulServer.php
View
@@ -203,10 +203,13 @@ function index() {
* @return String The serialized representation of the requested object(s) - usually XML or JSON.
*/
protected function getHandler($className, $id, $relationName) {
- $sort = array(
- 'sort' => $this->request->getVar('sort'),
- 'dir' => $this->request->getVar('dir')
- );
+ $sort = '';
+
+ if($this->request->getVar('sort')) {
+ $dir = $this->request->getVar('dir');
+ $sort = array($this->request->getVar('sort') => ($dir ? $dir : 'ASC'));
+ }
+
$limit = array(
'start' => $this->request->getVar('start'),
'limit' => $this->request->getVar('limit')

0 comments on commit e22eaec

Please sign in to comment.