• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/integrations/ui/entityselector/chatprovider.php
  • Класс: BitrixImOpenlinesIntegrationsUIEntitySelectorChatProvider
  • Вызов: ChatProvider::getChatsById
private function getChatsById(array $ids): array
{
	if (empty($ids))
	{
		return [];
	}

	$chats = ChatTable::query()
		->setSelect([
			'*',
			'RELATION_USER_ID' => 'RELATION.USER_ID',
			'RELATION_NOTIFY_BLOCK' => 'RELATION.NOTIFY_BLOCK',
			'RELATION_START_COUNTER' => 'RELATION.START_COUNTER',
			'ALIAS_NAME' => 'ALIAS.ALIAS',
		])
		->registerRuntimeField(
			'RELATION',
			new Reference(
				'RELATION',
				RelationTable::class,
				Join::on('this.ID', 'ref.CHAT_ID')->where('ref.USER_ID', User::getCurrent()->getId()),
			)
		)
		->whereIn('ID', $ids)
		->fetchAll()
	;
	$chats = BitrixImChat::fillCounterData($chats);
	$chatsByIds = [];

	foreach ($chats as $chat)
	{
		$chatsByIds[(int)$chat['ID']] = $chat;
	}

	return $chatsByIds;
}