• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/recycling/agentcontractbinder.php
  • Класс: Bitrix\Crm\Recycling\AgentContractBinder
  • Вызов: AgentContractBinder::getBoundEntityIDs
public function getBoundEntityIDs($associatedEntityTypeID, $associatedEntityID)
{
	if (
		$associatedEntityTypeID === \CCrmOwnerType::Company
		|| $associatedEntityTypeID === \CCrmOwnerType::Contact
	)
	{
		$result = [];

		$bindings = Crm\Integration\Catalog\Contractor\AgentContractContractorTable::query()
			->where('ENTITY_TYPE_ID', $associatedEntityTypeID,)
			->where('ENTITY_ID', $associatedEntityID,)
			->setSelect(['CONTRACT_ID'])
			->exec()
		;
		while ($binding = $bindings->fetch())
		{
			$result[] = $binding['CONTRACT_ID'];
		}

		return $result;
	}

	$entityTypeName = \CCrmOwnerType::ResolveName($associatedEntityTypeID);
	throw new Main\NotSupportedException("Entity '{$entityTypeName}' not supported in current context.");
}