• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Sku/SkuFactory.php
  • Класс: BitrixCatalogv2SkuSkuFactory
  • Вызов: SkuFactory::createEntity
public function createEntity(string $entityClass = null): BaseIblockElementEntity
{
	if ($entityClass === null)
	{
		$entityClass = $this->iblockInfo->canHaveSku() ? self::SKU : self::SIMPLE_SKU;
	}

	if ($entityClass === self::SKU && !$this->iblockInfo->canHaveSku())
	{
		throw new NotSupportedException(sprintf(
			'Product catalog {%s} does not support {%s} type.',
			$this->iblockInfo->getProductIblockId(), $entityClass
		));
	}

	if (!is_subclass_of($entityClass, BaseSku::class))
	{
		throw new NotSupportedException(sprintf(
			'Entity with type {%s} must be an instance of {%s}.',
			$entityClass, BaseSku::class
		));
	}

	return $this->makeEntity($entityClass);
}