• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/item/fieldimplementation/binding.php
  • Класс: Bitrix\Crm\Item\FieldImplementation\Binding
  • Вызов: Binding::configureUpdatingRefIdInBoundEntity
public function configureUpdatingRefIdInBoundEntity(Entity $boundEntity, string $thisIdField): self
{
	if (!$this->bindingEntity->hasField($thisIdField))
	{
		throw new ArgumentException("{$thisIdField} doesn't exist in Binding Entity");
	}

	$isFound = false;
	foreach ($this->bindingEntity->getFields() as $field)
	{
		if ($field instanceof Reference && $field->getRefEntity()->getFullName() === $boundEntity->getFullName())
		{
			$isFound = true;
			break;
		}
	}

	if (!$isFound)
	{
		throw new ArgumentException('The provided bound entity is not referenced by binding entity');
	}

	$this->boundEntity = $boundEntity;
	$this->thisIdField = $thisIdField;

	return $this;
}