RelationManager::unbindTypes

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. RelationManager
  4. unbindTypes
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Relation/RelationManager.php
  • Класс: Bitrix\Crm\Relation\RelationManager
  • Вызов: RelationManager::unbindTypes
public function unbindTypes(RelationIdentifier $identifier): Result
{
	$result = new Result();

	$existingRelation = $this->getRelation($identifier);

	if (!$existingRelation)
	{
		return $result->addError(
			new Error('The types are not bound', static::ERROR_CODE_UNBIND_TYPES_TYPES_NOT_BOUND)
		);
	}

	if ($existingRelation->isPredefined())
	{
		return $result->addError(
			new Error(
				"A predefined relation can't be unbound",
				static::ERROR_CODE_UNBIND_TYPES_RELATION_IS_PREDEFINED
			)
		);
	}

	$this->dropRelationsCache($identifier);

	return $this->deleteRelation($identifier);
}

Добавить комментарий