• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/commentitem.php
  • Класс: CTaskCommentItem
  • Вызов: CTaskCommentItem::fetchListFromDb
static function fetchListFromDb($taskData, $order = [], $filter = [])
{
	CTaskAssert::assertLaxIntegers($taskData['ID']);

	$comments = [];
	$commentsResult = null;

	if ($topicId = (int)$taskData['FORUM_TOPIC_ID'])
	{
		CTaskAssert::assert(MainLoader::includeModule('disk'));
		CTaskAssert::assert(MainLoader::includeModule('forum'));
		CTaskAssert::assert(MainLoader::includeModule('socialnetwork'));

		$filter = (is_array($filter) ? $filter : []);
		$filter['TOPIC_ID'] = $topicId;

		$commentsResult = MessageTable::getList([
			'filter' => $filter,
			'order' => $order,
		]);
		while ($comment = $commentsResult->fetch())
		{
			// typically the first one is a non-interesting system message, so skip it
			if ($comment['NEW_TOPIC'] === 'Y')
			{
				continue;
			}

			$comment = static::parseCommentPostMessage($comment);
			$comment = static::getCommentAttachmentIds($comment);

			$comments[] = $comment;
		}
	}

	return [$comments, $commentsResult];
}