- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/Relation/RelationManager.php
- Класс: Bitrix\Crm\Relation\RelationManager
- Вызов: RelationManager::updateTypesBinding
public function updateTypesBinding(Relation $relation): Result
{
$result = new Result();
$existingRelation = $this->getRelation($relation->getIdentifier());
if (!$existingRelation)
{
return $result->addError(
new Error(
'The types are not bound',
static::ERROR_CODE_UPDATE_TYPES_RELATION_NOT_BOUND,
)
);
}
if ($existingRelation->isPredefined())
{
return $result->addError(
new Error(
"A predefined relation can't be updated",
static::ERROR_CODE_UPDATE_TYPES_RELATION_IS_PREDEFINED,
)
);
}
$entityObject = $this->fetchEntityObject($relation->getIdentifier());
if (!$entityObject)
{
return $result->addError(
new Error(
'Record containing relation is not found',
static::ERROR_CODE_UPDATE_TYPES_RELATION_NOT_FOUND,
)
);
}
$this->dropRelationsCache($relation->getIdentifier());
return $this->updateEntityObject($relation->getSettings(), $entityObject);
}