private function renameJoinFields(SelectQuery $query, $namesMap = null, $originalSource = null) {
        if($namesMap == null) {
            $namesMap = $this->getColumnNames();
        }
        $joins = &$query->getJoins();
        if(!empty($joins)) {
            foreach ($joins as &$join) {
                $this->renameConditionFields($join, $namesMap, $originalSource, $query->getTable());
            }
        }
    }