• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/orm/query/query.php
  • Класс: Bitrix\Main\ORM\Query\Query
  • Вызов: Query::getInitAlias
public function getInitAlias($withPostfix = true)
{
	if ($this->custom_base_table_alias !== null)
	{
		return $this->custom_base_table_alias;
	}

	$init_alias = strtolower($this->entity->getCode());

	// add postfix
	if ($withPostfix)
	{
		$init_alias .= $this->table_alias_postfix;
	}

	// check length
	$connection = $this->entity->getConnection();
	$aliasLength = $connection->getSqlHelper()->getAliasLength();

	if (strlen($init_alias) > $aliasLength)
	{
		$init_alias = 'base';

		// add postfix
		if ($withPostfix)
		{
			$init_alias .= $this->table_alias_postfix;
		}
	}

	return $init_alias;
}