• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Multifield/Assembler.php
  • Класс: Bitrix\Crm\Multifield\Assembler
  • Вызов: Assembler::arrayByCollection
static function arrayByCollection(Collection $collection): array
{
	$array = [];

	$newValuesCountByType = [];
	foreach ($collection as $value)
	{
		$valueId = $value->getId();
		if ($valueId <= 0)
		{
			$count = $newValuesCountByType[$value->getTypeId()] ?? 0;

			$valueId = 'n' . $count;

			$count++;
			$newValuesCountByType[$value->getTypeId()] = $count;
		}

		$array[$value->getTypeId()][$valueId] = self::arrayByValue($value);
	}

	return $array;
}