PHP Class app\models\User

Inheritance: extends yii\db\ActiveRecord, implements yii\web\IdentityInterface
Show file Open project: phanan/koel Class Usage Examples

Protected Properties

Property Type Description
$casts
$guarded array The attributes that are protected from mass assign.
$hidden array The attributes excluded from the model's JSON form.
$hiddenPreferences array The preferences that we don't want to show to the client.
$table string The database table used by the model.

Public Methods

Method Description
connectedToLastfm ( ) : boolean Determine if the user is connected to Last.fm.
deletePreference ( string $key ) Delete a preference.
getLastfmSessionKeyAttribute ( ) : string | null Get the user's Last.fm session key.
getPreference ( string $key ) : string | null Get a preference item of the current user.
getPreferencesAttribute ( string $value ) : array Unserialize the user preferences back to an array before returning.
interactions ( )
playlists ( )
savePreference ( string $key, string $val ) Save a user preference.
setPreference ( $key, $val ) An alias to savePreference().
setPreferencesAttribute ( array $value ) User preferences are stored as a serialized associative array.

Method Details

connectedToLastfm() public method

Determine if the user is connected to Last.fm.
public connectedToLastfm ( ) : boolean
return boolean

deletePreference() public method

Delete a preference.
public deletePreference ( string $key )
$key string

getLastfmSessionKeyAttribute() public method

Get the user's Last.fm session key.
public getLastfmSessionKeyAttribute ( ) : string | null
return string | null The key if found, or null if user isn't connected to Last.fm

getPreference() public method

Get a preference item of the current user.
public getPreference ( string $key ) : string | null
$key string
return string | null

getPreferencesAttribute() public method

Unserialize the user preferences back to an array before returning.
public getPreferencesAttribute ( string $value ) : array
$value string
return array

interactions() public method

public interactions ( )

playlists() public method

public playlists ( )

savePreference() public method

Save a user preference.
public savePreference ( string $key, string $val )
$key string
$val string

setPreference() public method

An alias to savePreference().
public setPreference ( $key, $val )
$key
$val

setPreferencesAttribute() public method

User preferences are stored as a serialized associative array.
public setPreferencesAttribute ( array $value )
$value array

Property Details

$casts protected property

protected $casts

$guarded protected property

The attributes that are protected from mass assign.
protected array $guarded
return array

$hidden protected property

The attributes excluded from the model's JSON form.
protected array $hidden
return array

$hiddenPreferences protected property

The preferences that we don't want to show to the client.
protected array $hiddenPreferences
return array

$table protected property

The database table used by the model.
protected string $table
return string