Copied!

UserPreferenceService

UserPreferenceService.php : 19

User Preference Service.

This service provides methods for managing user preferences. It works in the context of a current User (obtained from the PermissionResolver).

Methods

publicgetUserPreference()

UserPreferenceService.php : 41

Get currently logged user preference by key.

public getUserPreference(string $userPreferenceName) : UserPreference

Parameters

Name Type Default value Description
$userPreferenceName string - -

Return values

UserPreference

Tags
Throws
UnauthorizedException

if the current user user is not allowed to fetch user preference

Throws
NotFoundException

publicgetUserPreferenceCount()

UserPreferenceService.php : 60

Get count of total preferences for currently logged user.

public getUserPreferenceCount() : int

Return values

int

publicloadUserPreferences()

UserPreferenceService.php : 53

Get currently logged user preferences.

public loadUserPreferences([int $offset = 0 ][, int $limit = 25 ]) : UserPreferenceList

Parameters

Name Type Default value Description
$offset int 0

the start offset for paging

$limit int 25

the number of user preferences returned

Return values

UserPreferenceList

Tags
Throws
InvalidArgumentException

publicsetUserPreference()

UserPreferenceService.php : 29

Set user preference.

public setUserPreference(array<string|int, UserPreferenceSetStruct$userPreferenceSetStructs) : void

Parameters

Name Type Default value Description
$userPreferenceSetStructs array<string|int, UserPreferenceSetStruct> - -
Tags
Throws
UnauthorizedException

If the current user user is not allowed to set user preference

Throws
InvalidArgumentException

If the $userPreferenceSetStruct is invalid