VolatileDedupeDataSource::prepareResult

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. VolatileDedupeDataSource
  4. prepareResult
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/volatilededupedatasource.php
  • Класс: Bitrix\Crm\Integrity\VolatileDedupeDataSource
  • Вызов: VolatileDedupeDataSource::prepareResult
protected function prepareResult(array &$map, DedupeDataSourceResult $result)
{
	$entityTypeID = $this->getEntityTypeID();
	foreach($map as $matchHash => &$entry)
	{
		$isValidEntry = false;
		$primaryQty = isset($entry['PRIMARY']) ? count($entry['PRIMARY']) : 0;
		if($primaryQty > 1)
		{
			$matches = $this->getEntityMatchesByHash($entityTypeID, $entry['PRIMARY'][0], $matchHash);
			if(is_array($matches))
			{
				$criterion = $this->createCriterionFromMatches($matches);
				$dup = new Duplicate($criterion, array());
				foreach($entry['PRIMARY'] as $entityID)
				{
					$dup->addEntity(new DuplicateEntity($entityTypeID, $entityID));
				}
				$result->addItem($matchHash, $dup);
				$isValidEntry = true;
			}
		}
		if (!$isValidEntry)
		{
			$result->addInvalidItem((string)$matchHash);
		}
	}
	unset($entry);
}

Добавить комментарий