本文整理汇总了PHP中Game::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::getId方法的具体用法?PHP Game::getId怎么用?PHP Game::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game::getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCreate
public function executeCreate(sfWebRequest $request)
{
$user = UserPeer::retrieveByPk($request->getParameter('username'));
if (!$user) {
$arr = array();
$arr["result"] = false;
$arr["message"] = "Invalid username";
$this->renderText(json_encode($arr));
return sfView::NONE;
}
$game = new Game();
$game->setIsPublic($request->getParameter('public', 0));
$game->setStartTime(time());
$game->setIsActive(true);
$game->setLatitude($request->getParameter('latitude'));
$game->setLongitude($request->getParameter('longitude'));
$game->save();
$gameMember = new GameMember();
$gameMember->setUserId($user->getId());
$gameMember->setGameId($game->getId());
$gameMember->setIsActive(true);
$gameMember->save();
$user->setCurrentGameId($game->getId());
$this->updateUserLocation($user, $request);
$arr = array();
$arr["result"] = true;
$arr["message"] = "Game created, game number is " . $game->getId() . ". When others join, you will be assigned a target";
$this->renderText(json_encode($arr));
return sfView::NONE;
}
示例2: addGameRow
public function addGameRow(Game $oGame, $includeField = true)
{
$oGame = Game::getByNefubId($oGame->nefub_id);
$field = $oGame->field ? $oGame->field : 1;
$gameType = $oGame->getCompetition()->getGender()->name . ' ' . $oGame->getCompetition()->getGenre()->name;
$team1 = utf8_decode($oGame->getTeam1()->name);
$team2 = utf8_decode($oGame->getTeam2()->name);
if ($oGame->getFirstReferee()) {
$oGame = new Game($oGame->getId());
$oReferee = $oGame->getFirstReferee();
$referee = utf8_decode($oReferee->getName());
if (!$oReferee->getPerson()) {
$referee .= ' (' . $oReferee->getTeam()->getCompetition()->getGender()->name;
$referee .= ' ' . $oReferee->getTeam()->getCompetition()->getGenre()->name . ')';
}
} else {
$referee = 'Onbekend';
}
$text = $oGame->getFormattedTime();
$text .= "\t";
$text .= $team1;
$text .= "\t";
$text .= $team2;
$text .= "\n";
$text .= $gameType;
if ($includeField) {
$text .= $field;
}
$this->section->addText($text, array('name' => 'Arial', 'size' => 10, 'bold' => false));
}
示例3: setGame
/**
* Declares an association between this object and a Game object.
*
* @param Game $v
* @return User The current object (for fluent API support)
* @throws PropelException
*/
public function setGame(Game $v = null)
{
if ($v === null) {
$this->setCurrentGameId(NULL);
} else {
$this->setCurrentGameId($v->getId());
}
$this->aGame = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Game object, it will not be re-added.
if ($v !== null) {
$v->addUser($this);
}
return $this;
}
示例4: createGameMetadata
private function createGameMetadata($gameId, $key, $value)
{
// given
$game = new Game($gameId);
if (!$game->getId()) {
$game->setValues(array("id", $gameId, "white" => "Alf"));
$game->commit();
}
$m = new MetadataValue($key);
// when
$m->setGameid($gameId);
$m->setMetadataKey($key);
$m->setMetadataValue($value);
$m->commit();
}
示例5: importGame
private function importGame($game, $intoDb = null)
{
$game['database_id'] = $intoDb;
$g = new Game();
$g->save($game);
return $g->getId();
}
示例6: Game
<?php
require_once './class/Game.class.php';
session_start();
if (count($_SESSION) == 0) {
$game = new Game();
$_SESSION['party_id'] = $game->getId();
$game->save();
} else {
header('Location: game.php');
}
示例7: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Game $value A Game object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Game $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例8: getGameWithAMove
private function getGameWithAMove()
{
$game = new Game();
$game->appendMove('e4');
return $game->getId();
}