• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/Configuration/Notification.php
  • Класс: BitrixImConfigurationNotification
  • Вызов: Notification::getUserSettings
static function getUserSettings(int $userId): array
{
	$defaultSettings = self::getDefaultSettings();

	$query =
		OptionStateTable::query()
			->setSelect(['NAME','VALUE'])
			->registerRuntimeField(
				'OPTION_USER_TABLE',
				new Reference(
					'OPTION_USER_TABLE',
					OptionUserTable::class,
					Join::on('this.GROUP_ID', 'ref.NOTIFY_GROUP_ID'),
					['join_type' => Join::TYPE_INNER]
				)
			)
			->where('OPTION_USER_TABLE.USER_ID', $userId)
			->whereLike('NAME', static::ENTITY.'%')
	;

	$rowSettings = [];
	foreach ($query->exec() as $rowSetting)
	{
		$rowSettings[] = $rowSetting;
	}

	if (empty($rowSettings))
	{
		return $defaultSettings;
	}

	$decodedSettings = static::decodeSettings($rowSettings);

	return array_replace_recursive($defaultSettings, $decodedSettings);
}