• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/controller/livefeed.php
  • Класс: BitrixSocialnetworkControllerLivefeed
  • Вызов: Livefeed::createEntityCommentAction
public function createEntityCommentAction(array $params = []): void
{
	$postEntityType = (isset($params['postEntityType']) && $params['postEntityType'] <> '' ? preg_replace('/[^a-z0-9_]/i', '', $params['postEntityType']) : false);
	$sourceEntityType = (isset($params['sourceEntityType']) && $params['sourceEntityType'] <> '' ? preg_replace('/[^a-z0-9_]/i', '', $params['sourceEntityType']) : false);
	$sourceEntityId = (int)($params['sourceEntityId'] ?? 0);
	$sourceEntityData = (array)($params['sourceEntityData'] ?? []);
	$entityType = (isset($params['entityType']) && $params['entityType'] <> '' ? preg_replace('/[^a-z0-9_]/i', '', $params['entityType']) : false);
	$entityId = (int)($params['entityId'] ?? 0);
	$logId = (int)($params['logId'] ?? 0);

	if (
		!$sourceEntityType
		|| $sourceEntityId <= 0
		|| !$entityType
		|| $entityId <= 0
	)
	{
		return;
	}

	if (in_array($sourceEntityType, [CommentAuxCreateEntity::SOURCE_TYPE_BLOG_POST, CommentAuxCreateEntity::SOURCE_TYPE_BLOG_COMMENT], true))
	{
		ServiceComment::processBlogCreateEntity([
			'ENTITY_TYPE' => $entityType,
			'ENTITY_ID' => $entityId,
			'SOURCE_ENTITY_TYPE' => $sourceEntityType,
			'SOURCE_ENTITY_ID' => $sourceEntityId,
			'SOURCE_ENTITY_DATA' => $sourceEntityData,
			'LIVE' => 'Y',
		]);
	}
	else
	{
		ServiceComment::processLogEntryCreateEntity([
			'LOG_ID' => $logId,
			'ENTITY_TYPE' => $entityType,
			'ENTITY_ID' => $entityId,
			'POST_ENTITY_TYPE' => $postEntityType,
			'SOURCE_ENTITY_TYPE' => $sourceEntityType,
			'SOURCE_ENTITY_ID' => $sourceEntityId,
			'SOURCE_ENTITY_DATA' => $sourceEntityData,
			'LIVE' => 'Y'
		]);
	}
}