• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/commentitem.php
  • Класс: CTaskCommentItem
  • Вызов: CTaskCommentItem::delete
public function delete(): bool
{
	// rights are checked inside forum`s taskEntity class, NO NEED to check rights
	// but for compatibility reasons, we have to leave exception throw here
	if (!$this->isActionAllowed(self::ACTION_COMMENT_REMOVE))
	{
		throw new TasksException('Action is not allowed', TasksException::TE_ACTION_NOT_ALLOWED);
	}

	$result = Comment::delete($this->itemId, $this->taskId);
	if (!$result->isSuccess())
	{
		$errorMessages = ($result->getErrors() ? $result->getErrors()->getMessages() : ['']);
		$errorCode = TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED | TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE;

		throw new TasksException(serialize($errorMessages), $errorCode);
	}

	return true;
}