• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/channel/entity/entitychannel.php
  • Класс: Bitrix\Crm\Integration\Channel\Entity\EntityChannelTable
  • Вызов: EntityChannelTable::unbind
static function unbind($entityTypeID, $entityID, array $bindings)
{
	if(!is_int($entityTypeID))
	{
		$entityTypeID = (int)$entityTypeID;
	}
	if($entityTypeID <= 0)
	{
		throw new Main\ArgumentException('Must be greater than zero', 'entityTypeID');
	}

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

	$qty = count($bindings);
	if($qty === 0)
	{
		return;
	}

	$connection = Main\Application::getConnection();
	for($i = 0; $i < $qty; $i++)
	{
		$binding = $bindings[$i];
		if(!is_array($binding))
		{
			continue;
		}

		$typeID = isset($binding['TYPE_ID']) ? (int)$binding['TYPE_ID'] : 0;
		if($typeID <= 0)
		{
			continue;
		}

		$connection->queryExecute(
		/** @lang text */
			"DELETE FROM b_crm_entity_channel WHERE ENTITY_TYPE_ID = {$entityTypeID} AND ENTITY_ID = {$entityID} AND TYPE_ID = {$typeID}"
		);
	}
}