当前位置: 首页>>代码示例>>PHP>>正文


PHP Game::getID方法代码示例

本文整理汇总了PHP中Game::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::getID方法的具体用法?PHP Game::getID怎么用?PHP Game::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game::getID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructs a GroupRequestQueue with entries matching the specified game and step.
  * 
  * @param Game $game the desired game
  * @param Round $round the desired round
  */
 public function __construct(Game $game, Round $round)
 {
     $this->requests = array();
     $dbh = Database::handle();
     $sth = $dbh->prepare('SELECT * FROM group_requests WHERE game = :game AND step = :step');
     $sth->bindValue(':game', $game->getID());
     $sth->bindValue(':step', strval($round));
     $sth->execute();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $expires = Util::sql2unixtime($row['expires']);
         if ($expires == 0) {
             $expires = NULL;
         }
         $this->requests[] = new GroupRequest(Session::fromSessionID($row['session']), $expires);
     }
 }
开发者ID:nmalkin,项目名称:basset,代码行数:22,代码来源:grouprequestqueue.php

示例2: getGroup

 /** @deprecated */
 public static function getGroup(Game $game, $step, Session $session)
 {
     $dbh = Database::handle();
     // find all groups with this game and step
     $sth = $dbh->prepare('SELECT * FROM groups WHERE game = :game AND step = :step');
     $sth->bindValue(':game', $game->getID());
     $sth->bindValue(':step', $step);
     $sth->execute();
     // find one that contains this session
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $session_ids = unserialize($row['sessions']);
         if (in_array($session->id, $session_ids)) {
             // use it to construct the group
             $sessions = array_map(function ($session_id) {
                 return Session::fromSessionID($session_id);
             }, $session_ids);
             return new Group($row['id'], $sessions, unserialize($row['data']));
         }
     }
     // couldn't find anything!
     throw new Exception('could not find group with matching game, step, and session');
 }
开发者ID:nmalkin,项目名称:basset,代码行数:23,代码来源:group.php

示例3: fromAssignmentID

 /**
  * Returns the session identified by the given assignment id.
  * 
  * @param string $assignment_id the AMT assignment ID, a unique ID given by Amazon to each assignment
  * @param Game $game the game associated with this assignment (should be known because HitId is also passed)
  * @throws DoesNotExistException if there is no session with this assignment ID and game
  */
 public static function fromAssignmentID($assignment_id, Game $game)
 {
     $game_id = $game->getID();
     $dbh = Database::handle();
     $sth = $dbh->prepare('SELECT session_id FROM sessions WHERE assignment_id = ? AND game = ?');
     $sth->execute(array($assignment_id, $game_id));
     if ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $session_id = $row['session_id'];
         return self::fromSessionID($session_id);
     } else {
         throw new DoesNotExistException('unknown assignment id');
     }
 }
开发者ID:nmalkin,项目名称:basset,代码行数:20,代码来源:session.php


注:本文中的Game::getID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。