• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Reservation/Entity/EntityBuilder.php
  • Класс: Bitrix\Crm\Reservation\Entity\EntityBuilder
  • Вызов: EntityBuilder::build
public function build(): Base
{
	$entity = null;
	if ($this->isDeal())
	{
		$entity = new Deal($this->ownerId);
	}
	elseif ($this->isDynamicEntity())
	{
		$entity = new DynamicEntity($this->ownerTypeId, $this->ownerId);
	}

	if ($entity)
	{
		if ($this->order)
		{
			$entity->setOrder($this->order);
		}

		if ($this->products)
		{
			foreach ($this->products as $product)
			{
				$entity->addProduct($product);
			}
		}

		return $entity;
	}

	$exceptionMessage = "Type {$this->ownerTypeId} not supported";
	$ownerTypeName = \CCrmOwnerType::ResolveName($this->ownerTypeId);
	if ($ownerTypeName)
	{
		$exceptionMessage = "$ownerTypeName not supported";
	}

	throw new Main\SystemException($exceptionMessage);
}