• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/conversion/entityconverter.php
  • Класс: Bitrix\Crm\Conversion\EntityConverter
  • Вызов: EntityConverter::mapEntityFields
public function mapEntityFields($entityTypeID, array $options = null)
{
	$map = Container::getInstance()->getConversionMapper()->getMap(
		new Crm\RelationIdentifier($this->sourceFactory->getEntityTypeId(), (int)$entityTypeID),
	);

	//todo call it in constructor?
	try
	{
		$this->initialize();
	}
	catch (SourceItemNotFoundException $exception)
	{
		return [];
	}

	$fields = [];
	foreach ($map->getItems() as $mapItem)
	{
		$fields[$mapItem->getDestinationField()] = $this->sourceItem->get($mapItem->getSourceField());

		if ($mapItem->getSourceField() === Item::FIELD_NAME_PRODUCTS)
		{
			//todo old api expects to find array of arrays in this case. Mark "special" fields in a map somehow?
			$fields[$mapItem->getDestinationField()] =
				$this->sourceItem->getProductRows() ? $this->sourceItem->getProductRows()->toArray() : []
			;
		}
	}

	return $fields;
}