Invite
extends Entity
in package
User invite class
This class maps the users_invites table.
Table of Contents
Properties
- $code : mixed
- $date : mixed
- $from_perso_id : mixed
- $from_user_id : mixed
- $lastError : string
- $to_user_id : int
- The user_id who have been claimed the invite Will be NULL as long as the invite haven't been claimed
- $db : DatabaseEngine
Methods
- __construct() : mixed
- Initializes a new instance
- create() : string
- Creates an invite code
- delete() : mixed
- Deletes the invite
- generate_code() : mixed
- Generates a unique invite code and sets it in the code property.
- get_invites_from() : array<string|int, string>
- Gets invites generated by the specified perso ID
- getDatabase() : DatabaseEngine
- is_claimed() : true
- Determines whether the current invite code have been claimed by an user.
- load_from_database() : bool
- Loads the object Invite (ie fill the properties) from the database
- save_to_database() : void
- Saves to database
- setDatabase() : void
- who_invited() : int|null
- Gets the perso ID who invited the specified perso
Properties
$code
public
mixed
$code
$date
public
mixed
$date
$from_perso_id
public
mixed
$from_perso_id
$from_user_id
public
mixed
$from_user_id
$lastError
public
string
$lastError
= ""
$to_user_id
The user_id who have been claimed the invite Will be NULL as long as the invite haven't been claimed
public
int
$to_user_id
= null
$db
private
DatabaseEngine
$db
Methods
__construct()
Initializes a new instance
public
__construct(DatabaseEngine $db[, mixed $code = null ]) : mixed
Parameters
- $db : DatabaseEngine
- $code : mixed = null
create()
Creates an invite code
public
static create(DatabaseEngine $db, Perso $perso) : string
Parameters
- $db : DatabaseEngine
- $perso : Perso
Return values
stringdelete()
Deletes the invite
public
delete() : mixed
generate_code()
Generates a unique invite code and sets it in the code property.
public
generate_code() : mixed
get_invites_from()
Gets invites generated by the specified perso ID
public
static get_invites_from(DatabaseEngine $db, Perso $perso) : array<string|int, string>
Parameters
- $db : DatabaseEngine
- $perso : Perso
Return values
array<string|int, string>getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEngineis_claimed()
Determines whether the current invite code have been claimed by an user.
public
is_claimed() : true
Return values
true —if the code have been claimed ; otherwise, false.
load_from_database()
Loads the object Invite (ie fill the properties) from the database
public
load_from_database() : bool
Return values
boolsave_to_database()
Saves to database
public
save_to_database() : void
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine
who_invited()
Gets the perso ID who invited the specified perso
public
static who_invited(DatabaseEngine $db, Perso $perso) : int|null
Parameters
- $db : DatabaseEngine
- $perso : Perso
Return values
int|null —the perso whom to get the invites ; or null, if nobody have invited him