protected function _orderBy(&$sql, &$bindParams)
{
if ($this->sortby) {
$sql .= ' ORDER BY';
foreach ($this->sortby as $sort) {
if (strpos($sort, '@') !== false) {
list($rel, $field) = explode('@', $sort);
if (!isset($this->relationships[$rel])) {
continue;
}
$sql .= ' ' . $this->relationships[$rel]['tableAlias'] . '.' . $field . ',';
} else {
$sql .= " {$sort},";
}
}
$sql = substr($sql, 0, -1);
}
}