User
extends Model
in package
Table of Contents
- $access : Access|null
- $accessId : int
- $activated : bool
- $blocked : bool
- $created : JsonDateTime
- $deleted : bool
- $email : string
- $id : int
- $image : Image
- $imageId : int
- $lastActivity : JsonDateTime
- $lastGeneratedKeyDate : JsonDateTime
- $loginFails : int
- $metadata : stdClass
- $name : string
- $password : string
- $surname : string
- $uniqueKey : string|null
- $updated : JsonDateTime
- $metadataShouldBeLoaded : bool
- __construct() : mixed
- __set() : mixed
- activate() : void
- Activates the user if provided key is correct
- assignUniqueKey() : void
- Assigns unique key to the user
- generateUniqueKey() : string
- generates unique key
- isSessionUser() : bool
- Checks if user is the user who performing request
- jsonSerialize() : array<string|int, mixed>
- Specify data which should be serialized to JSON
- loadMetadata() : void
- Triggers loading metadata to User JSON representation
- login() : void
- Login the user.
- unblock() : void
- Unblock the user if provided key is correct
- update() : void
- Updates model properties with form data
- validate() : void
- Domain object save validation callback.
- assertUniqueKeyIsCorrect() : void
- Asserts that the key provided by user is correct
Properties
$access
public
Access|null
$access
$accessId
public
int
$accessId
$activated
public
bool
$activated
$blocked
public
bool
$blocked
$created
public
JsonDateTime
$created
$deleted
public
bool
$deleted
public
string
$email
$id
public
int
$id
$image
public
Image
$image
$imageId
public
int
$imageId
$lastActivity
public
JsonDateTime
$lastActivity
$lastGeneratedKeyDate
public
JsonDateTime
$lastGeneratedKeyDate
$loginFails
public
int
$loginFails
$metadata
public
stdClass
$metadata
$name
public
string
$name
$password
public
string
$password
$surname
public
string
$surname
$uniqueKey
public
string|null
$uniqueKey
$updated
public
JsonDateTime
$updated
$metadataShouldBeLoaded
private
bool
$metadataShouldBeLoaded
= FALSE
Methods
__construct()
public
__construct(int $id, string $name, string $surname, string $email, string $password, bool $activated, int $loginFails, bool $blocked, bool $deleted, string|null $uniqueKey, JsonDateTime $lastGeneratedKeyDate, Access|null $access, Image $image, stdClass $metadata, JsonDateTime $lastActivity, JsonDateTime $created, JsonDateTime $updated, int $imageId, int $accessId) : mixed
Parameters
- $id : int
- $name : string
- $surname : string
- $email : string
- $password : string
- $activated : bool
- $loginFails : int
- $blocked : bool
- $deleted : bool
- $uniqueKey : string|null
- $lastGeneratedKeyDate : JsonDateTime
- $access : Access|null
- $image : Image
- $metadata : stdClass
- $lastActivity : JsonDateTime
- $created : JsonDateTime
- $updated : JsonDateTime
- $imageId : int
- $accessId : int
Return values
mixed —__set()
public
__set(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
Tags
Return values
mixed —activate()
Activates the user if provided key is correct
public
activate(string $userKey) : void
Parameters
- $userKey : string
Return values
void —assignUniqueKey()
Assigns unique key to the user
public
assignUniqueKey() : void
Return values
void —generateUniqueKey()
generates unique key
public
static generateUniqueKey([int $length = 6 ]) : string
Parameters
- $length : int = 6
Return values
string —isSessionUser()
Checks if user is the user who performing request
public
isSessionUser(stdClass $session) : bool
Parameters
- $session : stdClass
Return values
bool —jsonSerialize()
Specify data which should be serialized to JSON
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —loadMetadata()
Triggers loading metadata to User JSON representation
public
loadMetadata() : void
Return values
void —login()
Login the user.
public
login(string $userPassword) : void
Checks if the user is activated. Authenticate the user and handle blocking in case of too many failed tries.
Parameters
- $userPassword : string
Tags
Return values
void —unblock()
Unblock the user if provided key is correct
public
unblock(string $userKey) : void
Parameters
- $userKey : string
Return values
void —update()
Updates model properties with form data
public
update(stdClass $form) : void
Parameters
- $form : stdClass
Return values
void —validate()
Domain object save validation callback.
public
validate() : void
Tags
Return values
void —assertUniqueKeyIsCorrect()
Asserts that the key provided by user is correct
private
assertUniqueKeyIsCorrect(string $userKey) : void
Parameters
- $userKey : string