Match
class Match extends UrlModel implements NamedModel
A match played between two teams
Traits
Constants
OFFICIAL |
|
SPECIAL |
|
FUN |
|
TABLE |
The name of the database table used for queries |
CREATE_PERMISSION |
|
EDIT_PERMISSION |
|
SOFT_DELETE_PERMISSION |
|
HARD_DELETE_PERMISSION |
|
Methods
Get the name of the route that shows the object
Get a one word description of a match relative to a team (i.e. win, loss, or draw)
Get a one letter description of a match relative to a team (i.e. W, L, or T)
Get the timestamp of the last update of the match
Set the timestamp of the match
Get the first team involved in the match
Get the second team involved in the match
Get the color of Team A
Get the color of Team B
Get the list of players on Team A who participated in this match
Get the list of players on Team B who participated in this match
Set the players of the match's teams
Get the first team's points
Get the second team's points
Set the match team points
Get the ELO difference applied to each team's old ELO
Get the first team's new ELO
Get the second team's new ELO
Get the first team's old ELO
Get the second team's old ELO
Get the match type
Set the match type
Get a JSON decoded array of events that occurred during the match
Get the server address of the server where this match took place
Set the server address of the server where this match took place
Get the name of the replay file for this specific map
Get the match duration
Set the match duration
Get the user who entered the match
Get the loser of the match
Get the winner of a match
Determine whether the match was a draw
Find out if the match is played between official teams
Calculate the match's contribution to the team activity
Enter a new match to the database
Calculate the ELO score difference
Find if a match's stored ELO is correct
Recalculate the match's elo and adjust the team ELO values
Get all the matches in the database
Get a query builder for matches
Delete the object
Get the possible statuses representing an active model (visible to everyone)
Get the name of the entity
Details
at line line 186
static string
getRouteName(string $action = 'show')
Get the name of the route that shows the object
at line line 198
string
getMatchDescription(int|string|TeamInterface $teamID)
Get a one word description of a match relative to a team (i.e. win, loss, or draw)
at line line 216
string
getMatchLetter(int|string|TeamInterface $teamID)
Get a one letter description of a match relative to a team (i.e. W, L, or T)
at line line 228
int
getScore(int|string|TeamInterface $teamID)
Get the score of a specific team
at line line 252
int
getOpponentScore(int|string|TeamInterface $teamID)
Get the score of the opponent relative to a team
at line line 264
TeamInterface
getOpponent(int|string|TeamInterface $teamID)
Get the opponent of a match relative to a team ID
at line line 284
TimeDate
getUpdated()
Get the timestamp of the last update of the match
at line line 295
$this
setTimestamp(mixed $timestamp)
Set the timestamp of the match
at line line 306
TeamInterface
getTeamA()
Get the first team involved in the match
at line line 319
TeamInterface
getTeamB()
Get the second team involved in the match
at line line 332
string
getTeamAColor()
Get the color of Team A
at line line 341
string
getTeamBColor()
Get the color of Team B
at line line 350
Player[]|null
getTeamAPlayers()
Get the list of players on Team A who participated in this match
at line line 359
Player[]|null
getTeamBPlayers()
Get the list of players on Team B who participated in this match
at line line 369
Player[]|null
getPlayers(Team|int|null $team = null)
Get the list of players for a team in a match
at line line 391
Match
setTeamPlayers(int[] $teamAPlayers = array(), int[] $teamBPlayers = array())
Set the players of the match's teams
at line line 417
int
getTeamAPoints()
Get the first team's points
at line line 426
int
getTeamBPoints()
Get the second team's points
at line line 438
Match
setTeamPoints(int $teamAPoints, int $teamBPoints)
Set the match team points
at line line 453
Match
setTeamColors(ColorTeam|string $teamAColor, ColorTeam|string $teamBColor)
Set the match team colors
at line line 474
int
getEloDiff()
Get the ELO difference applied to each team's old ELO
at line line 483
int
getTeamAEloNew()
Get the first team's new ELO
at line line 492
int
getTeamBEloNew()
Get the second team's new ELO
at line line 501
int
getTeamAEloOld()
Get the first team's old ELO
at line line 510
int
getTeamBEloOld()
Get the second team's old ELO
at line line 521
int|null
getTeamEloNew(Team $team)
Get the team's new ELO
at line line 538
int|null
getTeamEloOld(Team $team)
Get the team's old ELO
at line line 553
Map
getMap()
Get the map where the match was played on
at line line 563
Match
setMap(int $map)
Set the map where the match was played
at line line 573
string
getMatchType()
Get the match type
at line line 585
Match
setMatchType(string $matchType)
Set the match type
at line line 594
mixed|null
getMatchDetails()
Get a JSON decoded array of events that occurred during the match
at line line 603
string|null
getServerAddress()
Get the server address of the server where this match took place
at line line 615
Match
setServerAddress($server = null)
Set the server address of the server where this match took place
at line line 627
string
getReplayFileName(int $length)
Get the name of the replay file for this specific map
at line line 640
int
getDuration()
Get the match duration
at line line 651
Match
setDuration(int $duration)
Set the match duration
at line line 660
Player
getEnteredBy()
Get the user who entered the match
at line line 670
TeamInterface
getLoser()
Get the loser of the match
at line line 684
TeamInterface
getWinner()
Get the winner of a match
at line line 706
bool
isDraw()
Determine whether the match was a draw
at line line 717
bool
involvesTeam(TeamInterface $team)
Find out whether the match involves a team
at line line 725
isOfficial()
Find out if the match is played between official teams
at line line 735
Match
resetELOs()
Reset the ELOs of the teams participating in the match
at line line 750
float
getActivity()
Calculate the match's contribution to the team activity
at line line 784
static Match
enterMatch($a, $b, $a_points, $b_points, $duration, $entered_by, $timestamp = 'now', $a_players = array(), $b_players = array(), $server = null, $replayFile = null, $map = null, $matchType = 'official', $a_color = null, $b_color = null)
Enter a new match to the database
at line line 859
static int
calculateEloDiff(int $a_elo, int $b_elo, int $a_points, int $b_points, int $duration)
Calculate the ELO score difference
Computes the ELO score difference on each team after a match, based on GU League's rules.
at line line 886
isEloCorrect()
Find if a match's stored ELO is correct
at line line 900
recalculateElo()
Recalculate the match's elo and adjust the team ELO values
at line line 929
static
getMatches()
Get all the matches in the database
at line line 938
static MatchQueryBuilder
getQueryBuilder()
Get a query builder for matches
at line line 957
void
delete()
Delete the object
Please note that this does not delete the object entirely from the database, it only hides it from users. You should overload this function if your object does not have a 'status' column which can be set to 'deleted'.
at line line 967
static string[]
getActiveStatuses()
Get the possible statuses representing an active model (visible to everyone)
at line line 975
string
getName()
Get the name of the entity