• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/entity_query.php
  • Класс: CEntityQuery
  • Вызов: CEntityQuery::buildJoin
protected function buildJoin()
{
	$sql = array();
	$csw = new CSQLWhere;

	foreach ($this->join_map as $join)
	{
		// prepare csw fields
		$csw_fields = $this->getJoinCswFields($join['reference']);
		$csw->setFields($csw_fields);

		// sql
		$sql[] = sprintf('%s JOIN %s %s ON %s',
			$join['type'], $join['table'],
			$this->DB->escL . $join['alias'] . $this->DB->escR,
			trim($csw->getQuery($join['reference']))
		);
	}

	return join("n", $sql);
}