• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/search/result/factory.php
  • Класс: Bitrix\Crm\Search\Result\Factory
  • Вызов: Factory::createProvider
static function createProvider(int $entityTypeId): Provider
{
	switch ($entityTypeId)
	{
		case \CCrmOwnerType::Lead:
			return new \Bitrix\Crm\Search\Result\Provider\IndexSupported\LeadProvider();
		case \CCrmOwnerType::Deal:
			return new \Bitrix\Crm\Search\Result\Provider\IndexSupported\DealProvider();
		case \CCrmOwnerType::Contact:
			return new \Bitrix\Crm\Search\Result\Provider\IndexSupported\ContactProvider();
		case \CCrmOwnerType::Company:
			return new \Bitrix\Crm\Search\Result\Provider\IndexSupported\CompanyProvider();
		case \CCrmOwnerType::Invoice:
			return new \Bitrix\Crm\Search\Result\Provider\InvoiceProvider();
		default:
			$factory = Container::getInstance()->getFactory($entityTypeId);
			if ($factory)
			{
				return new \Bitrix\Crm\Search\Result\Provider\FactoryBased($factory);
			}

			throw new NotImplementedException(
				\CCrmOwnerType::ResolveName($entityTypeId) . ' search result provider is not implemented'
			);
	}
}