Adds a JOIN clause

@param $firsttable - tablename
@param $secondtable - tablename
@param array $on - must be in the format array('firsttablecolumn' => 'secondtablecolumn, ...)
@param string $type - inner|full|left|right
@return $this
500900
protected function join($firsttable, $secondtable, Array $on, $type = 'inner') {
        $this->query->setJoin($firsttable, $secondtable, $on, strtoupper($type));
        return $this;
    }
852771
public function join($table, $cond = null, $type = '')
    {
        return $this->joinInternal($type, $table, $cond);
    }
931468
public function addJoin($join_field, $alias, $type = Join::INNER_JOIN, $cond = '')
    {
        $this->_queryBuilder->addJoin($join_field, $alias, $type, $cond);
        return $this;
    }
264278
public function innerJoin($join, $on = null)
    {
        $this->getJoins()->innerJoin($join, $on);

        return $this;
    }
820987
public function addInnerJoinUsing($table, $where)
    {
        //argument test
        Argument::i()
            //Argument 1 must be a string
            ->test(1, 'string')
            //Argument 2 must be a string
            ->test(2, 'string');
        
        $where = func_get_args();
        $table = array_shift($where);
        
        $this->join[] = array(self::INNER, $table, $where, true);
        
        return $this;
    }
653258
public function addJoin(Expression $foreign, Statement\Where $on, $joinType = Joins::INNER)
    {
        $this->getJoinStatement()->add($foreign, $on, $joinType);
        
        return $this;
    }
1265109
public function join($table, $on = null, $where = null, $binds = [], $type = 'LEFT')
    {
        if ($table instanceof Relation) {
            if (is_only_callable($on)) {
                /**
                 * Is this needed?
                 */
                Reflect::call($on, [$table, $table->getQuery()]);
            }

            $table->mergeToQuery($this->getQuery());
        } elseif ($table instanceof Entity) {
            $query = $table->getQuery();

            $sql = $query->buildSQL();

            $this->getQuery()->join(
                $type . ' JOIN (' . $sql . ') AS `' . $where . '` ON (' .
                (strpos($on, '(') ? '' : ($where . '.')) . $on . ')',
                null,
                null,
                $query->buildBinds()
            );
        } else {
            $this->getQuery()->join($table, $on, $where, $binds);
        }

        return $this;
    }
892950
public function leftJoin($trueTableName, $alias, $on) {
        $join = new Join($trueTableName, $alias, $on);
        $join->setType(Join::LEFT_JOIN);

        $this->statementContext->getJoinClause()->addJoin($join);
        return $this;
    }
1243625
public function join($joinType, $tableName = '', $on = [], $alias = '')
    {
        if (is_string($joinType) && empty($tableName)) {
            $this->sqlParts['join'][] = $this->getAdapter()->quoteSql($joinType);
        } elseif ($tableName instanceof self) {
            $this->sqlParts['join'][] = $this->sqlJoin($joinType, $tableName, $on, $alias);
        } else {
            $this->sqlParts['join'][$tableName] = $this->sqlJoin($joinType, $tableName, $on, $alias);

            $this->_joinAlias[$tableName] = $alias;
        }

        return $this;
    }
560454
function joinOnce($table_or_column, $on_clause_or_column = null, $join_type = self::JOIN) {
		if ($table_or_column instanceof QueryJoin) {
			$join = clone $table_or_column;
		} else {
			if (null === $on_clause_or_column) {
				if ($join_type == self::JOIN || $join_type == self::INNER_JOIN) {
					foreach ($this->extraTables as &$table) {
						if ($table == $table_or_column) {
							return $this;
						}
					}
					$this->addTable($table_or_column);
					return $this;
				}
				$on_clause_or_column = '1 = 1';
			}
			$join = new QueryJoin($table_or_column, $on_clause_or_column, $join_type);
		}
		foreach ($this->joins as &$existing_join) {
			if ($join->getTable() == $existing_join->getTable()) {
				if ($join->getAlias() != $existing_join->getAlias()) {
					// tables match, but aliases don't match
					continue;
				}
				// tables match, and aliases match or there are no aliases
				return $this;
			}
		}
		$this->joins[] = $join;
		return $this;
	}
863153
public function join($table, $alias = null, $on = null, $type = 'INNER JOIN')
    {
        $table = $this->connection->quoteIdentifier($table);

        $this->joins[$alias] = "$type $table $alias ON $on";

        return $this;
    }
905591
public function sqlJoin($joinType, $tableName, $on, $alias)
    {
        if (is_string($tableName)) {
            $tableName = TableNameResolver::getTableName($tableName, $this->tablePrefix);
        } elseif ($tableName instanceof self) {
            $tableName = $tableName->toSQL();
        }

        $onSQL = [];
        if (is_string($on)) {
            $onSQL[] = $this->getAdapter()->quoteSql($on);
        } else {
            foreach ($on as $leftColumn => $rightColumn) {
                if ($rightColumn instanceof Expression) {
                    $onSQL[] = $this->getQuotedName($leftColumn).'='.$this->getAdapter()->quoteSql($rightColumn->toSQL());
                } else {
                    $onSQL[] = $this->getQuotedName($leftColumn).'='.$this->getQuotedName($rightColumn);
                }
            }
        }

        if (false !== strpos($tableName, 'SELECT')) {
            return $joinType.' ('.$this->getAdapter()->quoteSql($tableName).')'.(empty($alias) ? '' : ' AS '.$this->getQuotedName($alias)).' ON '.implode(',', $onSQL);
        }

        return $joinType.' '.$this->getQuotedName($tableName).(empty($alias) ? '' : ' AS '.$this->getQuotedName($alias)).' ON '.implode(',', $onSQL);
    }
1297525
public function leftJoin($join, $on = null)
    {
        $this->getJoins()->leftJoin($join, $on);

        return $this;
    }
826601
public function addJoin(string $tableKey, string $type, ?string $source, $table, ?string $alias, $on = null, array $params = [])
    {
        $this->join[$tableKey] = [
            'type'   => $type,
            'source' => $source,

            'table' => $table,
            'alias' => $alias,

            'on'     => $on,
            'params' => $params,
        ];

        return $this;
    }
1134164
public function innerJoin($table, $alias = null, $on = null)
    {
        return $this->join($table, $alias, $on, 'INNER JOIN');
    }
930555
public function join($trueTableName, $alias, $on) {
        $join = new Join($trueTableName, $alias, $on);

        $this->statementContext->getJoinClause()->addJoin($join);
        return $this;
    }
315896
public function join($type, $table, $where, $using = true)
    {
        $linkage = $using ? 'USING ('.$where.')' : ' ON ('.$where.')';
        $this->joins[] = $type.' JOIN ' . $table . ' ' . $linkage;
        
        return $this;
    }