CallList::isEntitiesExist

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CallList
  4. isEntitiesExist
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/calllist.php
  • Класс: Bitrix\Crm\Controller\CallList
  • Вызов: CallList::isEntitiesExist
static function isEntitiesExist(string $type, array $entitiesId, \CRestServer $server): bool
{
	if (empty($entitiesId))
	{
		throw new RestException(
			'Incorrect entities id',
			self::ENTITIES_ERROR,
			$server::STATUS_WRONG_REQUEST
		);
	}

	if ($type === \CCrmOwnerType::ContactName)
	{
		$query =
			ContactTable::query()
				->addSelect('ID')
				->whereIn('ID', $entitiesId)
		;
	}
	elseif ($type === \CCrmOwnerType::CompanyName)
	{
		$query =
			CompanyTable::query()
				->addSelect('ID')
				->whereIn('ID', $entitiesId)
		;
	}

	$ids = [];
	foreach ($query->exec() as $entity)
	{
		$ids[] = (int)$entity['ID'];
	}

	return count($ids) === count($entitiesId);
}

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