• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/forumpost.php
  • Класс: BitrixSocialnetworkLivefeedForumPost
  • Вызов: ForumPost::getParentEntityId
public function getParentEntityId(): int
{
	$result = 0;

	$this->initSourceFields();
	$message = $this->getSourceFields();

	if (
		empty($message)
		|| (int)$message['TOPIC_ID'] <= 0
	)
	{
		return $result;
	}

	$res = TopicTable::getList([
		'filter' => [
			'=ID' => (int)$message['TOPIC_ID']
		],
		'select' => [ 'XML_ID' ],
	]);
	if (
		($topic = $res->fetch())
		&& !empty($topic['XML_ID'])
	)
	{
		if (preg_match('/^(TASK|EVENT|TOPIC|TIMEMAN_ENTRY|TIMEMAN_REPORT|PHOTO|IBLOCK)_(d+)$/i', $topic['XML_ID'], $matches))
		{
			$result = (int)$matches[2];
		}
		elseif (
			preg_match('/^(WF)_(.+)$/i', $topic['XML_ID'], $matches)
			&& Loader::includeModule('bizproc')
			&& $workflowIntegerId = CBPStateService::getWorkflowIntegerId($matches[2])
		)
		{
			$result = $workflowIntegerId;
		}
	}

	return $result;
}