• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/config/entity/entityconfig.php
  • Класс: Bitrix\Crm\Config\Entity\EntityConfigTable
  • Вызов: EntityConfigTable::deleteByEntity
static function deleteByEntity($entityTypeID, $entityID)
{
	if(!is_int($entityTypeID))
	{
		$entityTypeID = (int)$entityTypeID;
	}

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

	if(!is_int($entityID))
	{
		$entityID = (int)$entityID;
	}

	if($entityID <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero', 'entityID');
	}

	$connection = Main\Application::getConnection();
	$helper = $connection->getSqlHelper();
	$conditionSql = implode(
		' AND ',
		array(
			$helper->prepareAssignment('b_crm_entity_cfg', 'ENTITY_TYPE_ID', $entityTypeID),
			$helper->prepareAssignment('b_crm_entity_cfg', 'ENTITY_ID', $entityID)
		)
	);
	$connection->queryExecute('DELETE FROM b_crm_entity_cfg WHERE '.$conditionSql);
}