Comment::deleteAction

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

	// compatibility layer to previous version rest-api
	$loadedBindings = $this->loadBindings($id);
	if (!isset($ownerId, $ownerTypeId))
	{
		if (count($loadedBindings) > 1)
		{
			$this->addError(ErrorCode::getMultipleBindingsError());

			return;
		}

		$ownerId = (int)($loadedBindings[0]['ENTITY_ID'] ?? 0);
		$ownerTypeId = (int)($loadedBindings[0]['ENTITY_TYPE_ID'] ?? 0);
	}

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

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

		return;
	}

	$this->delete($id, $ownerTypeId, $ownerId, $bindings);
}

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