SessionModel
in package
implements
SessionModelInterface
AbstractYes
Session management model.
Table of Contents
Interfaces
- SessionModelInterface
- Session management model interface.
Constants
- SESSION_NAME = 'user'
- Key name of the session to store user information.
Methods
- get() : stdClass|string
- Get session.
- isset() : bool
- Isset session.
- set() : string
- Set session.
- unset() : string
- Session discarded.
- getUser() : array<string|int, mixed>
- Callback set session.
Constants
SESSION_NAME
Key name of the session to store user information.
public
string
SESSION_NAME
= 'user'
Methods
get()
Get session.
public
final static get([string $field = null ]) : stdClass|string
Parameters
- $field : string = null
-
(optional) If you want to retrieve only a specific field from the session, specify the name of that field.
Return values
stdClass|string —Session data.
isset()
Isset session.
public
final static isset() : bool
Return values
bool —Whether the session exists.
set()
Set session.
public
final static set(string $id[, mixed $value = null ]) : string
Parameters
- $id : string
-
It is ID if there is only one argument, column name if there are two arguments.
- $value : mixed = null
-
Set value.
Return values
string —Subclass Name.
unset()
Session discarded.
public
final static unset() : string
Return values
string —Subclass Name.
getUser()
Callback set session.
protected
abstract static getUser(string $id) : array<string|int, mixed>
Parameters
- $id : string
-
User ID.
Return values
array<string|int, mixed> —User data.