yii\db\QueryBuilder::buildJoin PHP Method

buildJoin() public method

public buildJoin ( array $joins, array &$params ) : string
$joins array
$params array the binding parameters to be populated
return string the JOIN clause built from [[Query::$join]].
    public function buildJoin($joins, &$params)
    {
        if (empty($joins)) {
            return '';
        }
        foreach ($joins as $i => $join) {
            if (!is_array($join) || !isset($join[0], $join[1])) {
                throw new Exception('A join clause must be specified as an array of join type, join table, and optionally join condition.');
            }
            // 0:join type, 1:join table, 2:on-condition (optional)
            list($joinType, $table) = $join;
            $tables = $this->quoteTableNames((array) $table, $params);
            $table = reset($tables);
            $joins[$i] = "{$joinType} {$table}";
            if (isset($join[2])) {
                $condition = $this->buildCondition($join[2], $params);
                if ($condition !== '') {
                    $joins[$i] .= ' ON ' . $condition;
                }
            }
        }
        return implode($this->separator, $joins);
    }