• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/conversion/entityconversionexception.php
  • Класс: Bitrix\Crm\Conversion\EntityConversionException
  • Вызов: EntityConversionException::__construct
public function __construct(
	$srcEntityTypeID = 0,
	$dstEntityTypeID = 0,
	$targ = 0,
	$code = 0,
	$extMessage = '',
	$file = '',
	$line = 0,
	\Exception $previous = null
)
{
	$this->srcEntityTypeID = $srcEntityTypeID;
	$this->dstEntityTypeID = $dstEntityTypeID;
	$this->targ = $targ;

	if(is_string($extMessage) && $extMessage !== '')
	{
		$this->extMessage = $extMessage;
	}

	$entityTypeName = ucfirst(\CCrmOwnerType::ResolveName($this->getTargetEntityTypeID()));
	if($code === self::NOT_FOUND)
	{
		$message = "The {$entityTypeName} entity is not found.";
	}
	elseif($code === self::NOT_SYNCHRONIZED)
	{
		$message = "The {$entityTypeName} entity user fields are not synchronized.";
	}
	elseif($code === self::INVALID_OPERATION)
	{
		$message = "Invalid operation.";
	}
	elseif($code === self::HAS_WORKFLOWS)
	{
		$message = "The {$entityTypeName} entity has autostarting workflows.";
	}
	elseif($code === self::AUTOCREATION_DISABLED)
	{
		$message = "Entity autocreation is disabled.";
	}
	elseif($code === self::EMPTY_FIELDS)
	{
		$message = "The {$entityTypeName} entity fields are empty.";
	}
	elseif($code === self::INVALID_FIELDS)
	{
		$message = "The {$entityTypeName} entity fields are invalid.";
	}
	elseif($code === self::READ_DENIED)
	{
		$message = "The {$entityTypeName} entity read is not permitted.";
	}
	elseif($code === self::CREATE_DENIED)
	{
		$message = "The {$entityTypeName} entity creation is not permitted.";
	}
	elseif($code === self::CREATE_FAILED)
	{
		$message = "Could not create a {$entityTypeName} entity.";
	}
	elseif($code === self::UPDATE_DENIED)
	{
		$message = "The {$entityTypeName} entity modification is not permitted.";
	}
	elseif($code === self::NOT_SUPPORTED)
	{
		$message = "The {$entityTypeName} entity type is not supported in current context.";
	}
	elseif ($code === self::NO_ACTIVE_DESTINATIONS)
	{
		$message = "No destinations selected for an entity of type {$entityTypeName}";
	}
	else
	{
		$message = 'A general error has occurred';
	}

	parent::__construct($message, $code, $file, $line, $previous);
}