Skip to content

Update Lib/Bancha/Network/BanchaRequestTransformer.php #38

Merged
merged 1 commit into from Mar 18, 2012
View
8 Lib/Bancha/Network/BanchaRequestTransformer.php
@@ -279,10 +279,14 @@ public function getPaging() {
unset($this->data['data'][0]['limit']);
}
$order = array();
+ $sort_field = '';
+ $direction = '';
if (isset($this->data['data'][0]) && is_array($this->data['data'][0]) && isset($this->data['data'][0]['sort'])) {
foreach ($this->data['data'][0]['sort'] as $sort) {
if (isset($sort['property']) && isset($sort['direction'])) {
- $order[$this->getController() . '.' . $sort['property']] = strtolower($sort['direction']);
+ $order[$this->getModel() . '.' . $sort['property']] = strtolower($sort['direction']);
+ $sort_field = $sort['property'];
+ $direction = $sort['direction'];
}
}
unset($this->data['data'][0]['sort']);
@@ -291,6 +295,8 @@ public function getPaging() {
'page' => $page,
'limit' => $limit,
'order' => $order,
+ 'sort' => $sort_field,
+ 'direction' => $direction
);
return $this->paginate;
}
Something went wrong with that request. Please try again.