protected function parseSort($sortParam)
{
foreach (explode(',', $sortParam) as $sortElem) {
//Check if ascending or derscenting(-) sort
if (preg_match('/^-.+/', $sortElem)) {
$direction = 'desc';
} else {
$direction = 'asc';
}
$pair = [preg_replace('/^-/', '', $sortElem), $direction];
//Only add the sorts that are on the base resource
if (strpos($sortElem, '.') === false) {
call_user_func_array([$this->query, 'orderBy'], $pair);
} else {
$this->additionalSorts[] = $pair;
}
}
}