コード例 #1
0
ファイル: score.php プロジェクト: neodyymi/Tsoha-Bootstrap
 /**
  * Fetches one score from database.
  *
  * @param int $id Id of score to be fetched.
  *
  * @return Score Returns score if found. Otherwise returns null.
  */
 public static function find($id)
 {
     $query = DB::connection()->prepare('SELECT * FROM Score WHERE id = :id LIMIT 1');
     $query->execute(array('id' => $id));
     $row = $query->fetch();
     if ($row) {
         $tmp = Score::getScore($row['id']);
         $throws = $tmp['throws'];
         $par = $tmp['par'];
         $score = new Score(array('id' => $row['id'], 'player' => $row['playerid'], 'roundId' => $row['roundid'], 'throws' => $throws, 'par' => $par));
         return $score;
     }
     return null;
 }