• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/restriction/clientfieldsrestriction.php
  • Класс: Bitrix\Crm\Restriction\ClientFieldsRestriction
  • Вызов: ClientFieldsRestriction::getCount
public function getCount(int $entityTypeId): int
{
	$cacheId = 'crm_client_fields_restriction_count_' . $entityTypeId;

	if ($this->cache->initCache(self::CACHE_TTL, $cacheId, self::CACHE_DIR))
	{
		return (int)$this->cache->getVars()['count'];
	}

	if ($entityTypeId === CCrmOwnerType::Deal)
	{
		$this->cache->startDataCache();
		$count = CCrmDeal::GetTotalCount();
		$this->cache->endDataCache(['count' => $count]);

		return $count;
	}

	throw new NotSupportedException('Entity type ' . $entityTypeId . ' is not supported');
}