• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/ParentFieldManager.php
  • Класс: Bitrix\Crm\Service\ParentFieldManager
  • Вызов: ParentFieldManager::getParentRelationElements
protected function getParentRelationElements(
	array $childrenIds,
	array $fields,
	int $entityTypeId
): array
{
	$parentIds = [];
	foreach ($fields as $field)
	{
		if (self::isParentFieldName($field))
		{
			$parentIds[] = (int)str_replace(self::FIELD_PARENT_PREFIX . '_', '', $field);
		}
	}

	$result = [];
	if (count($parentIds))
	{
		$result = EntityRelationTable::getList([
			'select' => [
				'SRC_ENTITY_TYPE_ID',
				'SRC_ENTITY_ID',
				'DST_ENTITY_ID'
			],
			'filter' => [
				'DST_ENTITY_TYPE_ID' => $entityTypeId,
				'DST_ENTITY_ID' => $childrenIds,
				'SRC_ENTITY_TYPE_ID' => $parentIds,
			]
		])->fetchAll();
	}

	return $result;
}