• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Settings/Preset/Preset.php
  • Класс: BitrixImV2SettingsPresetPreset
  • Вызов: Preset::loadByUserId
private function loadByUserId(int $userId): Result
{
	$result = new Result();
	$query = OptionGroupTable::query()
		->setSelect(['ID', 'NAME', 'SORT'])
		->where('USER_ID', $userId)
		->setLimit(1)
	;
	$row = $query->fetch();
	if (!$row)
	{
		return $result->addError(new PresetError(PresetError::NOT_FOUND));
	}

	$this->id = $row['ID'];
	$this->sort = $row['SORT'];
	$this->name = $row['NAME'];
	$this->personalUserId = $userId;
	$this->isExist = true;
	$this->general = new General($this->id);
	$this->notify = new Notify($this->id);

	return $result->setResult(true);
}