• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/ParentFieldManager.php
  • Класс: Bitrix\Crm\Service\ParentFieldManager
  • Вызов: ParentFieldManager::loadParentElementsByChildren
public function loadParentElementsByChildren(int $childEntityTypeId, array $items): array
{
	$parentRelationElements = [];

	foreach ($items as $item)
	{
		foreach ($item as $fieldName => $value)
		{
			if (static::isParentFieldName($fieldName))
			{
				$parentEntityTypeId = static::getEntityTypeIdFromFieldName($fieldName);
				$parentRelationElements[] = [
					'SRC_ENTITY_TYPE_ID' => $parentEntityTypeId,
					'SRC_ENTITY_ID' => (int)$value,
					'DST_ENTITY_ID' => $item['ID'],
					'DST_ENTITY_TYPE_ID' => $childEntityTypeId,
				];
			}
		}
	}

	if (empty($parentRelationElements))
	{
		return [];
	}

	$elementRelationsIds = $this->getElementRelationIds($parentRelationElements);
	$this->loadParentElements($elementRelationsIds);
	$this->prepareParentElements($parentRelationElements);

	return $this->parents;
}