Render a Join object

@param  SQL\Join $join
@return string
422119
public static function render(SQL\Join $join)
    {
        $condition = $join->getCondition();
        $table = $join->getTable();

        return Compiler::expression(array(
            $join->getType(),
            'JOIN',
            $table instanceof SQL\Aliased ? Aliased::render($table) : $table,
            is_array($condition) ? self::renderArrayCondition($condition) : $condition,
        ));
    }
1297525
public function leftJoin($join, $on = null)
    {
        $this->getJoins()->leftJoin($join, $on);

        return $this;
    }
682743
protected function visitSirelNodeJoin(Node\Join $join)
    {
        switch ($join->mode) {
            case Node\Join::INNER:
                $mode = "INNER";
                break;
            case Node\Join::LEFT:
                $mode = "LEFT";
                break;
            case Node\Join::LEFT_OUTER:
                $mode = "LEFT OUTER";
                break;
            case Node\Join::RIGHT:
                $mode = "RIGHT";
                break;
            case Node\Join::OUTER;
                $mode = "OUTER";
                break;
            default:
                $mode = '';
                break;
        }

        return ($join->natural ? 'NATURAL ' : '')
            . ($mode ? $mode . ' ' : '')
            . "JOIN "
            . $this->visit($join->left)
            . ($join->right ? ' ' . $this->visit($join->right) : '');
    }
1140942
public function selectOne(Query $query, $join = 'all')
        {
            $row = $this->rawSelectOne($query, $join);
            return $this->populateFromRow($row);
        }
1011415
private function _prepareJoin() 
	{
		$sQuery = '';

		if (is_array($this->_aJoin) && count($this->_aJoin) > 0) {

			foreach ($this->_aJoin as $sKey => $aValue) {

				if (isset($aValue['type']) && $aValue['type'] == 'left') {

					$sQuery .= " LEFT JOIN `".$aValue['table']."` ";
				}
				else {

					$sQuery .= " INNER JOIN `".$aValue['table']."` ";
				}

				if (isset($aValue['as']) && $aValue['as']) {

					$sQuery .= " AS ".$aValue['as']." ";
				}
				else {

					$sQuery .= " AS t".$this->_iAlias." ";
					$this->_iAlias++;
				}

				$sQuery .= " ON ".$aValue['left_field']." =  ".$aValue['right_field']." ";
			}
		}

		return $sQuery;
	}
1232132
public function fromToSql(?JoinClauseStrategy $join = null, bool $useClause = true): array
    {
        $params = [];

        $sql = [];

        foreach ($this->from as $from) {
            $from = $this->prepareFrom($from);

            $sqlPart = $from['table'];

            $from['alias'] && $sqlPart .= ' AS ' . $from['alias'];

            $params = array_merge($params, $from['params']);

            if ($join) {
                list($joinSql, $joinParams) = $join->joinToSql($from['tableKey']);

                if ($joinSql) {
                    $sqlPart .= ' ' . $joinSql;

                    $params = array_merge($params, $joinParams);
                }
            }

            $sql[] = $sqlPart;
        }

        $sql = implode(', ', $sql);

        if ($sql and $useClause) {
            $sql = 'FROM ' . $sql;
        }

        return [$sql, $params];
    }
473641
public function rawSelectOne(Query $query, $join = 'all')
        {
            $query->setTable($this);
            $query->setupJoinTables($join);
            $query->setLimit(1);
            $query->generateSelectSQL();

            $resultset = Statement::getPreparedStatement($query)->execute();
            $resultset->next();

            return $resultset->getCurrentRow();
        }
1026830
protected function _renderDistinct($sql)
    {
        if ($this->_parts[self::DISTINCT]) {
            $sql .= ' ' . self::SQL_DISTINCT;
        }

        return $sql;
    }
954272
public function joins(array $joins, $context) {
		$result = null;

		foreach ($joins as $key => $join) {
			if ($result) {
				$result .= ' ';
			}
			$join = is_array($join) ? $this->_instance('query', $join) : $join;
			$options['keys'] = ['mode', 'source', 'alias', 'constraints'];
			$result .= $this->renderCommand('join', $join->export($this, $options));
		}
		return $result;
	}
913665
public function getJoinFields()
    {
        $fields = null;
        $tmpFields = array();
        $joins = $this->_sql->getJoins();

        if (count($joins) > 0) {
            foreach ($joins as $join) {

                $tmpJoin = array();
                foreach ($join['fields'] as $field) {
                    $tmpJoin[] = "{$join['table']}.{$field}";
                }
                $str = implode(', ', $tmpJoin);
                if (strlen($str) > 1) {
                    $tmpFields[] = implode(', ', $tmpJoin);
                }
            }
            $fields = ', '. implode(', ', $tmpFields);
            if (trim($fields) == ',') $fields = null;
        }

        return $fields;
    }
664837
protected function parseJoin($join)
    {
        $result = implode(' ', $join);
        foreach($join as $item)
        {
            $this->params = array_merge($this->params, $item->getBinds());
        }
        return $result;
    }
1102325
public function join(Join $join)
    {
        $takenAliases = $this->getTakenAliases();

        if (in_array($join->getAlias(), $takenAliases, true)) {
            throw InvalidArgumentException::format(
                'Invalid join supplied to %s::%s: alias \'%s\' is already taken, taken aliases are (%s)',
                get_class($this), __FUNCTION__, $join->getAlias(), Debug::formatValues($takenAliases)
            );
        }


        $this->joins[] = $join;

        return $this;
    }
975287
public function join($query)
    {
        $clause = '';
        $repository = $query->getRepository();
        $resources = $repository->getResources();
        $links = $resources->getLinks();
        foreach ($links as $link) {
            $type = strtoupper($link->resource->getLinkType());
            switch ($type) {
                case 'STRONG' : $type = 'INNER';break;
                case 'WEAK'   : $type = 'LEFT'; break;
            }
            $query->join($type, $link->resource->getName().' AS '.$this->_store->quoteName($link->resource->getAlias()), array(
                $link->child.'='.$link->parent,
            ));
        }

        $this->_links($query, $query->link);

        if (!empty($query->join)) {
            $joins = array();
            foreach ($query->join as $join) {
                $tmp = '';

                if (!empty($join['type'])) {
                    $tmp .= $join['type'].' ';
                }

                $tmp .= 'JOIN '.$join['resource'];
                $tmp .= ' ON '.implode(' AND ', $join['condition']);

                $joins[] = $tmp;
            }

            $clause = implode(' ', $joins);
        }

        return $clause;
    }
19518
public static function getJoinAlias(Join $join): string
    {
        @trigger_error(sprintf('The use of "%s::getJoinAlias()" is deprecated since 2.3 and will be removed in 3.0. Use "%s::getAlias()" directly instead.', __CLASS__, Join::class), E_USER_DEPRECATED);

        return $join->getAlias();
    }
924397
protected function joins(array $joins): string
	{
		if(empty($joins))
		{
			return '';
		}

		$sql = [];

		foreach($joins as $join)
		{
			$sql[] = $join->getType() . ' JOIN ' . $this->table($join->getTable()) . ' ON ' . $this->joinConditions($join);
		}

		return ' ' . implode(' ', $sql);
	}
898870
public function compileJoin(string $condition): string
	{
		$parts = $this->parseJoin($condition);
		$count = count($parts['identifiers']);

		// Go through and quote the identifiers
		for($i=0; $i <= $count; $i++)
		{
			if (in_array($parts['combined'][$i], $parts['identifiers']) && ! is_numeric($parts['combined'][$i]))
			{
				$parts['combined'][$i] = $this->db->quoteIdent($parts['combined'][$i]);
			}
		}

		return implode('', $parts['combined']);
	}
154619
protected function compileOneJoin(Join $join, array &$bindings): string
    {
        $sql = $join->type.' JOIN '.$this->compileIdentifierWithAlias($join->table, $join->tableAlias, $bindings);

        if ($join->criteria) {
            $sql .= ' ON '.$this->compileCriteria($join->criteria, $bindings);
        }

        return $sql;
    }