Message
extends Entity
in package
Message class
This class maps the messages table.
It also provides a static method to get perso's messages.
Table of Contents
Properties
- $date : mixed
- $flag : mixed
- $id : mixed
- $lastError : string
- $perso : Perso|null
- $source : MessageSource
- $text : mixed
- $to : mixed
- $db : DatabaseEngine
- $from : mixed
Methods
- __construct() : mixed
- Initializes a new instance
- delete() : void
- Deletes the message
- get_messages() : mixed
- Gets messages from the specified perso
- getDatabase() : DatabaseEngine
- isSelf() : bool
- load_from_database() : bool
- Loads the object Message (ie fill the properties) from the database
- load_from_form() : mixed
- Loads the object Message (ie fill the properties) from the $_POST array
- save_to_database() : void
- Saves to database
- send() : void
- Sends the message
- setAsSystem() : mixed
- setDatabase() : void
- setFrom() : mixed
- computeSource() : mixed
Properties
$date
public
mixed
$date
$flag
public
mixed
$flag
$id
public
mixed
$id
$lastError
public
string
$lastError
= ""
$perso
public
Perso|null
$perso
$source
public
MessageSource
$source
$text
public
mixed
$text
$to
public
mixed
$to
$db
private
DatabaseEngine
$db
$from
private
mixed
$from
Methods
__construct()
Initializes a new instance
public
__construct(DatabaseEngine $db[, int $id = null ]) : mixed
Parameters
- $db : DatabaseEngine
- $id : int = null
-
the primary key
delete()
Deletes the message
public
delete() : void
get_messages()
Gets messages from the specified perso
public
static get_messages(DatabaseEngine $db, Perso $perso[, bool $mark_as_read = true ][, int &$countNewMessages = 0 ]) : mixed
Parameters
- $db : DatabaseEngine
- $perso : Perso
- $mark_as_read : bool = true
- $countNewMessages : int = 0
getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEngineisSelf()
public
isSelf() : bool
Return values
boolload_from_database()
Loads the object Message (ie fill the properties) from the database
public
load_from_database() : bool
Return values
boolload_from_form()
Loads the object Message (ie fill the properties) from the $_POST array
public
load_from_form() : mixed
save_to_database()
Saves to database
public
save_to_database() : void
send()
Sends the message
public
send() : void
setAsSystem()
public
setAsSystem() : mixed
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine
setFrom()
public
setFrom(Perso $perso) : mixed
Parameters
- $perso : Perso
computeSource()
private
computeSource() : mixed