EntityCounterFactory::create

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. EntityCounterFactory
  4. create
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/counter/entitycounterfactory.php
  • Класс: Bitrix\Crm\Counter\EntityCounterFactory
  • Вызов: EntityCounterFactory::create
public function create($entityTypeID, $typeID, $userID = 0, array $extras = null)
{
	if(!is_int($entityTypeID))
	{
		$entityTypeID = (int)$entityTypeID;
	}

	if(!\CCrmOwnerType::IsDefined($entityTypeID))
	{
		throw new Main\ArgumentOutOfRangeException("entityTypeID: $entityTypeID",
			\CCrmOwnerType::FirstOwnerType,
			\CCrmOwnerType::LastOwnerType
		);
	}

	if($entityTypeID === \CCrmOwnerType::Deal)
	{
		return new DealCounter($typeID, $userID, $extras);
	}
	elseif($entityTypeID === \CCrmOwnerType::Activity)
	{
		return new ActivityCounter($typeID, $userID, $extras);
	}

	return new EntityCounter($entityTypeID, $typeID, $userID, $extras);
}

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