__addJoinsToQuery__(query, queryInfo, includeColumns) {

    let columns = this.Model.columnQueryInfo(includeColumns);
    let joins = queryInfo.joins;

    // Set join OrderBys... in reverse order
    let orderBy = queryInfo.commands.reduce((arr, command) => {
      command.orderBy && (arr = command.orderBy.concat(arr));
      return arr;
    }, []);

    Object.keys(joins).forEach(joinName => {
      joins[joinName].forEach(j => {
        columns = columns.concat(this.__joinedColumns__(j.joinAlias, j.shortAlias));
      });
    });

    // When doing joins, we count paramOffset as the last where parameter length
    // Because we add in a bunch of parameters at the end.
    let params = query.params.slice();
    let joinSQL = this.db.adapter.generateUnionQuery(
      Object.keys(queryInfo.joins).map((name, i) => {
        let join = queryInfo.joins[name];
        let sql = this.db.adapter.generateSelectQuery(
          query.sql,
          `j`,
          columns,
          null,
          join,
          null,
          orderBy,
          null,
          params.length
        );
        join.forEach(j => { params = params.concat(this.db.adapter.getParamsFromMultiFilter(j.multiFilter)); });
        return sql;
      })
    );

    return {
      sql: this.db.adapter.generateSelectQuery(
        joinSQL || query.sql,
        'm',
        joinSQL ? '*' : columns,
        null,
        null,
        null,
        orderBy,
        null,
        params.length
      ),
      params: params
    };

  }
Add Joins to a query from queryInfo
@param {Object} query Must be format {sql: '', params: []}
@param {Object} queryInfo Must be format {commands: [], joins: []}
@param {Array} [includeColumns=*] Which columns to include, includes all by default
@return {Object} Has "params" and "sql" properties.
@private