PHP Class PartKeepr\AuthBundle\Services\UserPreferenceService

Mostra file Open project: partkeepr/PartKeepr Class Usage Examples

Public Methods

Method Description
__construct ( EntityManager $entityManager )
deletePreference ( User $user, string $key ) Removes a specific setting for a specific user.
deletePreferences ( User $user ) Removes all preferences for specific user. This is usually used when removing the user.
getPreference ( User $user, string $key ) : UserPreference Returns a specific preference object for the given user.
getPreferenceValue ( User $user, string $key ) : string Returns a specific preference value for the given user.
getPreferences ( User $user ) : UserPreference[] Returns all preferences for the given user.
setPreference ( User $user, string $key, string $value ) : UserPreference Creates or updates a preference for a given user.

Method Details

__construct() public method

public __construct ( EntityManager $entityManager )
$entityManager Doctrine\ORM\EntityManager

deletePreference() public method

Removes a specific setting for a specific user.
public deletePreference ( User $user, string $key )
$user PartKeepr\AuthBundle\Entity\User The user to delete the preference for
$key string The key to delete

deletePreferences() public method

Removes all preferences for specific user. This is usually used when removing the user.
public deletePreferences ( User $user )
$user PartKeepr\AuthBundle\Entity\User The user to delete the preference for

getPreference() public method

Returns a specific preference object for the given user.
public getPreference ( User $user, string $key ) : UserPreference
$user PartKeepr\AuthBundle\Entity\User The user to retrieve the preference for
$key string The preference key to retrieve
return PartKeepr\AuthBundle\Entity\UserPreference The preference object

getPreferenceValue() public method

Returns a specific preference value for the given user.
public getPreferenceValue ( User $user, string $key ) : string
$user PartKeepr\AuthBundle\Entity\User The user to retrieve the preference for
$key string The preference key to retrieve
return string The preference string

getPreferences() public method

Returns all preferences for the given user.
public getPreferences ( User $user ) : UserPreference[]
$user PartKeepr\AuthBundle\Entity\User The user
return PartKeepr\AuthBundle\Entity\UserPreference[] An array of UserPreference objects

setPreference() public method

Creates or updates a preference for a given user.
public setPreference ( User $user, string $key, string $value ) : UserPreference
$user PartKeepr\AuthBundle\Entity\User The user to set the preference for
$key string The key to set
$value string The value to set
return PartKeepr\AuthBundle\Entity\UserPreference The user preference