• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/comment.php
  • Класс: Bitrix\Crm\Controller\Timeline\Comment
  • Вызов: Comment::updateAction
public function updateAction($id, array $fields, int $ownerTypeId = null, int $ownerId = null): ?int
{
	$id = is_numeric($id) ? (int)$id : null;
	if (!$this->assertValidCommentRecord($id))
	{
		return null;
	}

	// compatibility layer to previous version rest-api
	if (!isset($ownerId, $ownerTypeId))
	{
		[$ownerId, $ownerTypeId] = $this->detectOwnerIds($id);
	}

	if (!$this->assertValidOwner($ownerId, $ownerTypeId))
	{
		return null;
	}

	$params = compact('id', 'ownerTypeId', 'ownerId');
	[$content, $filesList] = $this->fetchFieldsToUpdate($fields, $params);

	if (!$this->assertValidCommentContent($content))
	{
		return null;
	}

	[$isBindingsExist, $bindings] = $this->detectBindings($id, $ownerId, $ownerTypeId);
	if (!$isBindingsExist)
	{
		$this->addError(ErrorCode::getNotFoundError());

		return null;
	}

	return $this->update($id, $ownerTypeId, $ownerId, $content, $filesList, $bindings);
}