• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/crm/reader.php
  • Класс: BitrixImOpenLinesCrmReader
  • Вызов: Reader::prepareEntities
private function prepareEntities(array $entities): self
{
	$mappedEntities = array_map(static function($entity){
		if (is_string($entity['ENTITY_TYPE']))
		{
			$entity['ENTITY_TYPE_ID'] = CCrmOwnerType::ResolveID($entity['ENTITY_TYPE']);
		}
		else
		{
			$entity['ENTITY_TYPE_ID'] = $entity['ENTITY_TYPE'];
		}

		return $entity;
	}, $entities);

	$this->typedEntities = [];
	foreach ($mappedEntities as $entity)
	{
		$this->typedEntities[$entity['ENTITY_TYPE_ID']][$entity['ENTITY_ID']] = $entity['ENTITY_ID'];
	}

	$this->contactIds = $this->typedEntities[CCrmOwnerType::Contact] ?? [];
	$this->companyIds = $this->typedEntities[CCrmOwnerType::Company] ?? [];

	return $this;
}