• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/duplicatecommunicationcriterion.php
  • Класс: Bitrix\Crm\Integrity\DuplicateCommunicationCriterion
  • Вызов: DuplicateCommunicationCriterion::getRegisteredEntityMatches
static function getRegisteredEntityMatches($entityTypeID, $entityID, $type = '')
{
	if(!is_int($entityTypeID))
	{
		throw new Main\ArgumentTypeException('entityTypeID', 'integer');
	}

	if(!is_int($entityID))
	{
		throw new Main\ArgumentTypeException('entityID', 'integer');
	}

	$params = array(
		'select' =>array('ID', 'TYPE', 'VALUE'),
		'order' => array('ID' =>'ASC'),
		'filter' =>  array(
			'ENTITY_TYPE_ID' => $entityTypeID,
			'ENTITY_ID' => $entityID
		)
	);

	if($type !== '')
	{
		$params['filter']['TYPE'] = $type;
	}

	$dbResult = DuplicateCommunicationMatchCodeTable::getList($params);
	$results = array();
	while($fields = $dbResult->fetch())
	{
		$matches = array(
			'TYPE' => isset($fields['TYPE']) ? $fields['TYPE'] : '',
			'VALUE' => isset($fields['VALUE']) ? $fields['VALUE'] : ''
		);
		$results[self::prepareMatchHash($matches)] = $matches;
	}
	return $results;
}