private function renameOrderByFields(SelectQuery $query, $namesMap = null, $originalSource = null) {
        if($namesMap == null) {
            $namesMap = $this->getColumnNames();
        }
        $orderByFields = &$query->getOrderByFields();
        if (!empty($orderByFields)) {
            foreach ($orderByFields as &$orderByField) {
                $newName = $this->getFieldNewName($orderByField->field, $namesMap, $originalSource, $query->getTable());
                if($newName != null) {
                    $orderByField->field = $newName;
                }
            }
        }
    }