• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/order/matcher/entitymatchmanager.php
  • Класс: Bitrix\Crm\Order\Matcher\EntityMatchManager
  • Вызов: EntityMatchManager::create
public function create(Order $order)
{
	$entities = [];

	$entityProperties = $this->getEntityProperties($order);
	$assignedById = $this->getAssignedById($order);
	$duplicateMode = $this->getDuplicateMode($order);

	if (!empty($entityProperties[\CCrmOwnerType::Company]))
	{
		$matcher = new CompanyMatcher();

		$matcher->setProperties($entityProperties[\CCrmOwnerType::Company]);
		$matcher->setAssignedById($assignedById);
		$matcher->setDuplicateControlMode($duplicateMode);

		$entities[\CCrmOwnerType::Company] = $matcher->create();
	}

	if (!empty($entityProperties[\CCrmOwnerType::Contact]))
	{
		$matcher = new ContactMatcher();

		$matcher->setProperties($entityProperties[\CCrmOwnerType::Contact]);
		$matcher->setAssignedById($assignedById);
		$matcher->setDuplicateControlMode($duplicateMode);

		if (!empty($entities[\CCrmOwnerType::Company]))
		{
			$matcher->setRelation(\CCrmOwnerType::Company, $entities[\CCrmOwnerType::Company]);
		}

		$entities[\CCrmOwnerType::Contact] = $matcher->create();
	}

	return $entities;
}