• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Relation/StorageStrategy/Factory.php
  • Класс: Bitrix\Crm\Relation\StorageStrategy\Factory
  • Вызов: Factory::editBinding
protected function editBinding(ItemIdentifier $child, int $parentEntityTypeId, int $value): Result
{
	$item = $this->childFactory->getItem($child->getEntityId());
	if (!$item)
	{
		return (new Result())->addError(new Error('The child item does not exist: ' . $child));
	}

	$previousParentId = $item->get($this->parentIdFieldName);

	$item->set($this->parentIdFieldName, $value);

	$operation = $this->childFactory->getUpdateOperation($item);

	$operation->disableCheckAccess();

	$toExcludeFromTimeline = [];
	if ($previousParentId > 0)
	{
		$toExcludeFromTimeline[] = new ItemIdentifier($parentEntityTypeId, $previousParentId);
	}
	if ($value > 0)
	{
		$toExcludeFromTimeline[] = new ItemIdentifier($parentEntityTypeId, $value);
	}
	$operation->excludeItemsFromTimelineRelationEventsRegistration($toExcludeFromTimeline);

	return $operation->launch();
}