Chat::getChatId

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Chat
  4. getChatId
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/im/chat.php
  • Класс: Bitrix\Crm\Integration\Im\Chat
  • Вызов: Chat::getChatId
static function getChatId($entityTypeID, $entityID)
{
	if (!\Bitrix\Main\Loader::includeModule('im'))
	{
		return 0;
	}

	if (!\CCrmOwnerType::IsDefined($entityTypeID) || $entityID <= 0)
	{
		return 0;
	}

	$entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
	$chatData = \Bitrix\Im\Model\ChatTable::getList(
		[
			'select' => ['ID'],
			'filter' => [ '=ENTITY_TYPE' => self::CHAT_ENTITY_TYPE,  '=ENTITY_ID' => $entityTypeName.'|'.$entityID ],
		]
	)->fetch();
	return is_array($chatData) && isset($chatData['ID']) ? (int)$chatData['ID'] : 0;
}

Добавить комментарий