MatchMakingLobby/Services/MatchMakingService.php
function getMatch($matchId)
	{
		$match = $this->db->execute(
				'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '.
				'FROM Matches '.
				'WHERE id = %d ',
				$matchId
			)->fetchObject(__NAMESPACE__.'\\Match');
		if(!$match)
			return false;

		$results = $this->db->execute(
				'SELECT P.login, P.teamId, P.rank, P.state '.
				'FROM Players P '.
				'WHERE P.matchId = %d ', $match->id
			)->fetchArrayOfAssoc();

		foreach($results as $row)
		{
			$match->players[] = $row['login'];
			$match->playersState[$row['login']] = $row['state'];

			if($row['rank'] !== null)
			{
					$match->ranking[$row['rank']][] = $row['login'];
			}

			if($row['teamId'] === null)
			{
				continue;
			}
			elseif((int)$row['teamId'] === 0)
			{
				$match->team1[] = $row['login'];
			}
			elseif((int)$row['teamId'] === 1)
			{
				$match->team2[] = $row['login'];
			}
		}
		uksort($match->ranking, function ($k1, $k2)
		{
			if($k1 == 0)
			{
				return 1;
			}
			if($k1 > $k2)
			{
				return 1;
			}
			else
			{
				return $k1 == $k2 ? 0: -1;
			}
		});
		return $match;
	}
function getMatch($matchId)
	{
		$match = $this->db->execute(
				'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '.
				'FROM Matches '.
				'WHERE id = %d ',
				$matchId
			)->fetchObject(__NAMESPACE__.'\\Match');
		if(!$match)
			return false;

		$results = $this->db->execute(
				'SELECT P.login, P.teamId, P.rank, P.state '.
				'FROM Players P '.
				'WHERE P.matchId = %d ', $match->id
			)->fetchArrayOfAssoc();

		foreach($results as $row)
		{
			$match->players[] = $row['login'];
			$match->playersState[$row['login']] = $row['state'];

			if($row['rank'] !== null)
			{
					$match->ranking[$row['rank']][] = $row['login'];
			}

			if($row['teamId'] === null)
			{
				continue;
			}
			elseif((int)$row['teamId'] === 0)
			{
				$match->team1[] = $row['login'];
			}
			elseif((int)$row['teamId'] === 1)
			{
				$match->team2[] = $row['login'];
			}
		}
		uksort($match->ranking, function ($k1, $k2)
		{
			if($k1 == 0)
			{
				return 1;
			}
			if($k1 > $k2)
			{
				return 1;
			}
			else
			{
				return $k1 == $k2 ? 0: -1;
			}
		});
		return $match;
	}
function getMatch ( $ matchId ) { $ match = $ this -> db -> execute ( 'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 ' . 'FROM Matches ' . 'WHERE id = %d ' , $ matchId ) -> fetchObject ( __NAMESPACE__ . '\\Match' ) ; if ( ! $ match ) return false ; $ results = $ this -> db -> execute ( 'SELECT P.login, P.teamId, P.rank, P.state ' . 'FROM Players P ' . 'WHERE P.matchId = %d ' , $ match -> id ) -> fetchArrayOfAssoc ( ) ; foreach ( $ results as $ row ) { $ match -> players [ ] = $ row [ 'login' ] ; $ match -> playersState [ $ row [ 'login' ] ] = $ row [ 'state' ] ; if ( $ row [ 'rank' ] !== null ) { $ match -> ranking [ $ row [ 'rank' ] ] [ ] = $ row [ 'login' ] ; } if ( $ row [ 'teamId' ] === null ) { continue ; } elseif ( ( int ) $ row [ 'teamId' ] === 0 ) { $ match -> team1 [ ] = $ row [ 'login' ] ; } elseif ( ( int ) $ row [ 'teamId' ] === 1 ) { $ match -> team2 [ ] = $ row [ 'login' ] ; } } uksort ( $ match -> ranking , function ( $ k1 , $ k2 ) { if ( $ k1 == 0 ) { return 1 ; } if ( $ k1 > $ k2 ) { return 1 ; } else { return $ k1 == $ k2 ? 0 : - 1 ; } } ) ; return $ match ; }
Get matchServer information
@param string $serverLogin
@param string $scriptName
@param string $titleIdString
@return Match
Get matchServer information