class Conversation extends UrlModel implements NamedModel

A discussion (group of messages)

Constants

TABLE

The name of the database table used for queries

Methods

string
getSubject()

Get the subject of the discussion

getCreator()

Get the creator of the discussion

bool
isCreator(int $id)

Determine whether a player is the one who created the message conversation

isEditor($player)

{@inheritdoc}

getLastActivity()

Get the time when the conversation was most recently active

void
updateLastActivity()

Update the conversation's last activity timestamp

setSubject(string $subject)

Update the conversation's subject

getLastMessage()

Get the last message of the conversation

bool
isReadBy(int $playerId)

Find whether the last message in the conversation has been read by a player

void
markReadBy(int $playerId)

Mark the last message in the conversation as having been read by a player

void
markUnread(int $except)

Mark the last message in the conversation as unread by the conversation's members

static string
getRouteName(string $action = 'show')

Get the name of the route that shows the object

static string[]
getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

string
getName()

Get the name of the entity

Model[]
getMembers(int|null $hide = null)

Get a list containing each member of the conversation

Player[]
getMissingTeamMembers(Team $team)

Get the members of one of the conversation's teams that don't belong in the conversation

int[]
getPlayerIds(int|null $hide = null, bool $distinct = false)

Get a list containing the IDs of each member player of the conversation

int[]
getTeamIds()

Get a list containing the IDs of each member team of the conversation

static Conversation
createConversation(string $subject, int $creatorId, array $members = array())

Create a new message conversation *

sendMessage(Player $from, string $message, string $status = 'visible')

Send a new message to the conversation's members

bool
isMember(Player|Team $member, bool $distinct = false)

Checks if a player or team belongs in the conversation

void
addMember(Player|Team $member, bool $distinct = true)

Add a member to the discussion

bool
isTeamMember(Player $member)

Find out if a player belongs to any of the conversation's teams

void
removeMember(Player|Team $member)

Remove a member from the discussion

int[]
getWaitingForEmailIDs(int $except, bool $read = true)

Find out which members of the conversation should receive an e-mail after a new message has been sent

getQueryBuilder()

Get a query builder for conversations

Details

at line line 62
string getSubject()

Get the subject of the discussion

Return Value

string

at line line 72
Player getCreator()

Get the creator of the discussion

Return Value

Player

at line line 83
bool isCreator(int $id)

Determine whether a player is the one who created the message conversation

Parameters

int $id The ID of the player to test for

Return Value

bool

at line line 91
isEditor($player)

{@inheritdoc}

Parameters

$player

at line line 101
TimeDate getLastActivity()

Get the time when the conversation was most recently active

Return Value

TimeDate

at line line 111
void updateLastActivity()

Update the conversation's last activity timestamp

Return Value

void

at line line 123
Conversation setSubject(string $subject)

Update the conversation's subject

Parameters

string $subject The new subject

Return Value

Conversation

at line line 133
Message getLastMessage()

Get the last message of the conversation

Return Value

Message

at line line 150
bool isReadBy(int $playerId)

Find whether the last message in the conversation has been read by a player

Parameters

int $playerId The ID of the player

Return Value

bool

at line line 164
void markReadBy(int $playerId)

Mark the last message in the conversation as having been read by a player

Parameters

int $playerId The ID of the player

Return Value

void

at line line 178
void markUnread(int $except)

Mark the last message in the conversation as unread by the conversation's members

Parameters

int $except The ID of a player to exclude

Return Value

void

at line line 189
static string getRouteName(string $action = 'show')

Get the name of the route that shows the object

Parameters

string $action The route's suffix

Return Value

string

at line line 197
static string[] getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

Return Value

string[]

at line line 205
string getName()

Get the name of the entity

Return Value

string

at line line 215
Model[] getMembers(int|null $hide = null)

Get a list containing each member of the conversation

Parameters

int|null $hide The ID of a player to ignore

Return Value

Model[] An array of players and teams

at line line 234
Player[] getMissingTeamMembers(Team $team)

Get the members of one of the conversation's teams that don't belong in the conversation

Parameters

Team $team The team to check

Return Value

Player[]

at line line 256
int[] getPlayerIds(int|null $hide = null, bool $distinct = false)

Get a list containing the IDs of each member player of the conversation

Parameters

int|null $hide The ID of a player to ignore
bool $distinct Whether to only return players who were specifically invited to the conversation, and are not participating only as members of a team

Return Value

int[] An array of player IDs

at line line 278
int[] getTeamIds()

Get a list containing the IDs of each member team of the conversation

Return Value

int[] An array of team IDs

at line line 291
static Conversation createConversation(string $subject, int $creatorId, array $members = array())

Create a new message conversation *

Parameters

string $subject The subject of the conversation
int $creatorId The ID of the player who created the conversation
array $members A list of Models representing the conversation's members

Return Value

Conversation An object that represents the created conversation

at line line 315
Message sendMessage(Player $from, string $message, string $status = 'visible')

Send a new message to the conversation's members

Parameters

Player $from The sender
string $message The body of the message
string $status The status of the message - can be 'visible', 'hidden', 'deleted' or 'reported'

Return Value

Message An object that represents the sent message

at line line 332
bool isMember(Player|Team $member, bool $distinct = false)

Checks if a player or team belongs in the conversation

Parameters

Player|Team $member The player or team to check
bool $distinct Whether to only return true if a player is specifically a member of the conversation, not just a member of one of the conversation's teams (ignored if $member is a Team)

Return Value

bool True if the given object belongs in the conversation, false if they don't

at line line 358
void addMember(Player|Team $member, bool $distinct = true)

Add a member to the discussion

Parameters

Player|Team $member The member to add
bool $distinct Whether to add the member as a distinct player (ignored for teams)

Return Value

void

at line line 398
bool isTeamMember(Player $member)

Find out if a player belongs to any of the conversation's teams

This does not take into account whether the player is a distinct member of the conversation (i.e. they have been invited separately)

Parameters

Player $member The player to check

Return Value

bool

at line line 418
void removeMember(Player|Team $member)

Remove a member from the discussion

Parameters

Player|Team $member The member to remove

Return Value

void

at line line 459
int[] getWaitingForEmailIDs(int $except, bool $read = true)

Find out which members of the conversation should receive an e-mail after a new message has been sent

Parameters

int $except The ID of a player who won't receive an e-mail (e.g. message author)
bool $read Whether to only send e-mails to players who have read all the previous messages in the conversation

Return Value

int[] A player ID list

at line line 479
static ConversationQueryBuilder getQueryBuilder()

Get a query builder for conversations