本文整理汇总了PHP中Team::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::getId方法的具体用法?PHP Team::getId怎么用?PHP Team::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: with
/**
* Only include matches where a specific team played
*
* @param Team $team Team The team which played the matches
* @param string $result string|null The outcome of the matches (win, draw or loss)
* @return self
*/
public function with($team, $result = null)
{
if (!$team || !$team->isValid()) {
return $this;
}
switch ($result) {
case "wins":
case "win":
case "victory":
case "victories":
$query = "(team_a = ? AND team_a_points > team_b_points) OR (team_b = ? AND team_b_points > team_a_points)";
break;
case "loss":
case "lose":
case "losses":
case "defeat":
case "defeats":
$query = "(team_a = ? AND team_b_points > team_a_points) OR (team_b = ? AND team_a_points > team_b_points)";
break;
case "draw":
case "draws":
case "tie":
case "ties":
$query = "(team_a = ? OR team_b = ?) AND team_a_points = team_b_points";
break;
default:
$query = "team_a = ? OR team_b = ?";
}
$this->conditions[] = $query;
$this->parameters[] = $team->getId();
$this->parameters[] = $team->getId();
$this->types .= 'ii';
return $this;
}
示例2: with
/**
* Only include matches where a specific team/player played
*
* @param Team|Player $participant The team/player which played the matches
* @param string $result The outcome of the matches (win, draw or loss)
* @return self
*/
public function with($participant, $result = null)
{
if (!$participant || !$participant->isValid()) {
return $this;
}
if ($participant instanceof Team) {
$team_a_query = "team_a = ?";
$team_b_query = "team_b = ?";
} elseif ($participant instanceof Player) {
$team_a_query = "FIND_IN_SET(?, team_a_players)";
$team_b_query = "FIND_IN_SET(?, team_b_players)";
} else {
throw new InvalidArgumentException("Invalid model provided");
}
switch ($result) {
case "wins":
case "win":
case "victory":
case "victories":
$query = "({$team_a_query} AND team_a_points > team_b_points) OR ({$team_b_query} AND team_b_points > team_a_points)";
break;
case "loss":
case "lose":
case "losses":
case "defeat":
case "defeats":
$query = "({$team_a_query} AND team_b_points > team_a_points) OR ({$team_b_query} AND team_a_points > team_b_points)";
break;
case "draw":
case "draws":
case "tie":
case "ties":
$query = "({$team_a_query} OR {$team_b_query}) AND team_a_points = team_b_points";
break;
default:
$query = "{$team_a_query} OR {$team_b_query}";
}
$this->conditions[] = $query;
$this->parameters[] = $participant->getId();
$this->parameters[] = $participant->getId();
return $this;
}
示例3: load
public function load()
{
$this->clear();
// Miami Hurricanes
$team = new Team('Miami, FL');
$team->setOfficialName('University of Miami');
$team->setNickname('Hurricanes');
$team->setCity('Miami');
$team->setState('FL');
$team->setNcaaId(415);
$level = $this->CI->_level->findOneBySlug('college');
$team->setLevel($level);
$league = $this->CI->_league->findOneBySlug('ncaa');
$team->setLeague($league);
$division = $this->CI->_division->findOneBySlug('d1');
$team->setDivision($division);
$conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
$team->setConference($conference);
$team->save();
print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
// Maryland Terrapins
$team = new Team('Maryland');
$team->setOfficialName('University of Maryland');
$team->setNickname('Terrapins');
$team->setCity('College Park');
$team->setState('FL');
$team->setNcaaId(392);
$level = $this->CI->_level->findOneBySlug('college');
$team->setLevel($level);
$league = $this->CI->_league->findOneBySlug('ncaa');
$team->setLeague($league);
$division = $this->CI->_division->findOneBySlug('d1');
$team->setDivision($division);
$conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
$team->setConference($conference);
$team->save();
print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
}
示例4: removeMember
/**
* Remove a member from the discussion
*
* @todo
*
* @param Player|Team $member The member to remove
* @return void
*/
public function removeMember($member)
{
if ($member instanceof Player) {
$this->db->query("DELETE FROM `player_groups` WHERE `group` = ? AND `player` = ?", "ii", array($this->getId(), $member->getId()));
} else {
throw new Exception("Not implemented yet");
}
}
示例5: getTeams
public static function getTeams()
{
$dados = Database::ReadAll("team t", "t.*");
if (!$dados) {
return '';
}
foreach ($dados as $dado) {
$team = new Team();
$team->setId($dado['ID_TEAM']);
$team->setName($dado['NAME_TEAM']);
$team->setStatus($dado['STATUS']);
$calebe = Calebe::getCalebe("AND c.id_person = " . $dado['ID_LEADER']);
$team->setLeader($calebe);
$team->setMembers(Team::getMembersTeam($team->getId()));
$teams[] = $team;
}
return $teams;
}
示例6: getTeamEloOld
/**
* Get the team's old ELO
* @param Team $team The team whose old ELO to return
* @return int|null The old ELO, or null if the team provided has not
* participated in the match
*/
public function getTeamEloOld(Team $team)
{
if ($team->getId() == $this->team_a) {
return $this->getTeamAEloOld();
} elseif ($team->getId() == $this->team_b) {
return $this->getTeamBEloOld();
}
return null;
}
示例7: findAvailable
public function findAvailable(Team $team)
{
$q = $this->createQuery('u')->where('NOT EXISTS (SELECT * FROM UserPerTeam upt WHERE upt.team_id = ? and upt.user_id = u.id)', $team->getId());
return $q->execute();
}
示例8: 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 Team $obj A Team object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
TeamPeer::$instances[$key] = $obj;
}
}
示例9: prune
/**
* Exclude object from result
*
* @param Team $team Object to remove from the list of results
*
* @return TeamQuery The current query, for fluid interface
*/
public function prune($team = null)
{
if ($team) {
$this->addUsingAlias(TeamPeer::ID, $team->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
示例10: ensureConsistency
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aDealer !== null && $this->dealer_id !== $this->aDealer->getId()) {
$this->aDealer = null;
}
if ($this->aTeam !== null && $this->team_id !== $this->aTeam->getId()) {
$this->aTeam = null;
}
}
示例11: serialize
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize(array('team' => $this->team->getId(), 'deleter' => $this->deleter->getId()));
}
示例12: testMiscMethods
public function testMiscMethods()
{
$this->team = Team::createTeam("Sample Team", $this->player->getId(), "Avatar", "Description");
$team = Team::get($this->team->getId());
$this->assertEquals("now", $team->getCreationDate());
}
示例13: getTooltipProjectCandidates
private function getTooltipProjectCandidates(Team $team)
{
$projects = $team->getProjects();
$teamid = $team->getId();
$candidatesList = array();
foreach ($projects as $id => $name) {
$project = ProjectCache::getInstance()->getProject($id);
// do not display SideTasksProjects & ExternalTaskProject
if ($project->isExternalTasksProject() || $project->isSideTasksProject(array($teamid))) {
continue;
}
$candidatesList[$id] = $name;
}
return $candidatesList;
}
示例14: removeTeam
public function removeTeam(Team $team)
{
$this->unlink('Teams', array($team->getId()));
$this->save();
}
示例15: lookup
function lookup($id)
{
return $id && is_numeric($id) && ($team = new Team($id)) && $team->getId() == $id ? $team : null;
}