• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/channel/entity/entitychannel.php
  • Класс: Bitrix\Crm\Integration\Channel\Entity\EntityChannelTable
  • Вызов: EntityChannelTable::getBindingByType
static function getBindingByType($entityTypeID, $entityID, $typeID)
{
	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');
	}

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

	$dbResult =  Main\Application::getConnection()->query(
	/** @lang text*/
		"SELECT TYPE_ID, ORIGIN_ID, COMPONENT_ID FROM b_crm_entity_channel WHERE ENTITY_ID = {$entityID} AND ENTITY_TYPE_ID = {$entityTypeID} AND TYPE_ID = {$typeID}"
	);

	$results = array();
	while($ary = $dbResult->fetch())
	{
		$ary['TYPE_ID'] = (int)$ary['TYPE_ID'];
		$results[] = $ary;
	}
	return $results;
}