Build a jointure.
@param  string $type
@param  string $table
@param  array  $conditions
@param  string $alias
@return string
488042
protected function buildJointure($type, $table, $conditions, $alias=null) {
		$params = [];
		$jointure = '';
		switch($type) {
			case 'leftjoin':
				$jointure = "\n".'LEFT JOIN ';
				break;
			case 'rightjoin':
				$jointure = "\n".'RIGHT JOIN ';
				break;
			case 'innerjoin':
				$jointure = "\n".'INNER JOIN ';
				break;
		}

		if($table instanceof static) {
			$_table = '('.$table->buildSQL().') '.$this->quote.$alias.$this->quote;
			$params = array_merge($params, $table->getParameters());
			$table = $_table;
		}
		elseif($table instanceof Raw) {
			$_table = '('.$table->getSQL().') '.$this->quote.$alias.$this->quote;
			$params = array_merge($params, $table->getParameters());
			$table = $_table;
		}
		else {
			if($alias !== null)
				$table = $table.' '.$alias;
			$table = preg_replace_callback('/(^[a-z_][a-zA-Z0-9._]*)| ([a-z_][a-zA-Z0-9._]*$)/', function($matches) {
					return $this->identifierQuotes($matches[0]);
			}, $table);
		}

		$jointure .= $table;
		if($conditions) {
			$r = $this->processConditions($conditions);
			$jointure .= ' ON '.$r[0];
			$params = array_merge($params, $r[1]);
		}
		return [$jointure, $params];
	}
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;
    }
320163
public function join($table, $type = null)
	{
		$this->_join[] = $this->_last_join = new \Database_Query_Builder_Join($table, $type);

		return $this;
	}
757645
protected function _addJoin($type, $table, $fields, $on = []) {
        $repo = $this->getRepository();
        $join = new Join($type);
        $conditions = [];

        if (is_array($table)) {
            $alias = $table[1];
            $table = $table[0];
        } else {
            $alias = $table;
        }

        foreach ($on as $pfk => $rfk) {
            if (strpos($pfk, '.') === false) {
                $pfk = $repo->getAlias() . '.' . $pfk;
            }

            if (strpos($rfk, '.') === false) {
                $rfk = $alias . '.' . $rfk;
            }

            $conditions[$pfk] = $rfk;
        }

        $this->_joins[] = $join->from($table, $alias)->on($conditions)->fields($fields);

        return $this;
    }
639901
public function join($type, $table, array $relations = array())
    {
        $this->append(sprintf(' %s JOIN %s ', $type, $table));

        // Append relations if provided
        if (!empty($relations)) {
            // First on
            $this->on();

            $i = 0; // Iteration counter
            $count = count($relations);

            foreach ($relations as $column => $value) {
                // Increment iteration count
                $i++;

                $this->equals($column, $value);

                // If last iteration
                if ($i != $count) {
                    $this->rawAnd();
                }
            }
        }

        return $this;
    }
56973
public function join($join, $condition = null, $type = 'INNER')
    {
        if (empty($condition)) {
            // 如果为组数，则循环调用join
            foreach ($join as $key => $value) {
                if (is_array($value) && 2 <= count($value)) {
                    $this->join($value[0], $value[1], isset($value[2]) ? $value[2] : $type);
                }
            }
        } else {
            $table = $this->getJoinTable($join);

            $this->options['join'][] = [$table, strtoupper($type), $condition];
        }

        return $this;
    }
121628
public function leftJoin(string $table, $criteria = null, string $alias = null): self
    {
        $table = $this->getTableNameByClassName($table);
        $this->join($table, $criteria, self::LEFT_JOIN, $alias);

        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);
    }
667053
public function from($table, $alias = null) {
        $this->_table = (string) $table;
        $this->asAlias($alias);

        return $this;
    }
417109
public function join($table, $condition = null, $type = 'LEFT')
    {
        settype($table, 'array');

        $data = array(
            'table'     => current($table),
            'condition' => $condition,
            'type'      => $type
        );

        if (is_string(key($table))) {
            $this->join[key($table)] = $data;
        } else {
            $this->join[] = $data;
        }

        return $this;
    }
961581
public function join($table, $condition, $joinType = self::JOIN_LEFT)
    {
        $this->join[] = [
            'table' => $table,
            'condition' => $condition,
            'jointType' => $joinType
        ];
        return $this;
    }
1334408
public function rightJoin($table, $criteria = null, $alias = null)
    {
        return $this->join($table, $criteria, self::RIGHT_JOIN, $alias);
    }
720569
final public function join($table, $cond, $type = 'LEFT')
    {

        if ($type != '') {
            $type = strtoupper(trim($type));

            if (!in_array($type, array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'))) {
                $type = '';
            } else {
                $type .= ' ';
            }
        }
        // Extract any aliases that might exist.  We use this information
        // in the _protect_identifiers to know whether to add a table prefix
        $this->traceTableAlias($table);

        // Strip apart the condition and protect the identifiers
        if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) {
            $match[1] = $this->identifiers($match[1]);
            $match[3] = $this->identifiers($match[3]);

            $cond = $match[1] . $match[2] . $match[3];
        }
        // Assemble the JOIN statement
        $join = $type . 'JOIN ' . $this->identifiers($table) . ' ON ' . $cond;

        $this->arrayJoin[] = $join;
        if ($this->arrayCaching === TRUE) {
            $this->arrayCacheJoin[] = $join;
            $this->arrayCacheExists[] = 'join';
        }

        return $this;
    }
15488
private function BuildSource(Sql\Table $table, Sql\Join $join = null, Sql\JoinType $joinType = null, Sql\Condition $joinCondition = null)
    {
        $src = $table;
        if ($join)
        {
            if (!$joinType || !$joinCondition)
                throw new \InvalidArgumentException("If join is given, a join type and join condition are also required.");
            
            $src = $join->Join($table, $joinType, $joinCondition, true);
        }
        return $src;
    }
54966
private function join(string $table, $criteria = null, string $type = self::INNER_JOIN, string $alias = null): self
    {
        // 是否存在判断...

        if (\is_string($criteria)) {
            $criteria = [$criteria];
        }

        $this->join[] = [
            'table'    => $table,
            'criteria' => $criteria,
            'type'     => $type,
            'alias'    => $alias,
        ];

        return $this;
    }
170867
private function join($type, $table, $col, $op, $col2 = '')
    {
        $col = $this->formatColumn($col);
        $col2 = $this->formatColumn($col2);
        $this->_sql['join'][$type][] = [$table, $col, $op, $col2];
        return $this;
    }
227658
public function join($type, $conditions)
  {
    if ( is_null($this->join) ){
      $this->join = [];
    }
    $this->join[] = new Element(strtoupper($type) . ' JOIN', $conditions);
    return $this;
  }