本文整理汇总了PHP中ArrayData::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayData::getField方法的具体用法?PHP ArrayData::getField怎么用?PHP ArrayData::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayData
的用法示例。
在下文中一共展示了ArrayData::getField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetField
function testSetField()
{
$arrayData = new ArrayData(array());
$arrayData->setField('d', 'Delta');
$this->assertTrue($arrayData->hasField('d'));
$this->assertEquals('Delta', $arrayData->getField('d'));
}
示例2: view
public function view(SS_HTTPRequest $request)
{
$params = $request->params();
$game_id = $params['ID'];
$game = Game::get()->filter('ID', $game_id)->first();
$teams = $game->Teams();
$allTeams = array();
foreach ($teams as $team) {
$teamArr = array();
$player_one = Player::get()->filter('ID', $team->PlayerOne)->first();
$player_two = Player::get()->filter('ID', $team->PlayerTwo)->first();
$teamArr['Names'] = $player_one->Name . ' & ' . $player_two->Name;
$teamArr['GamesPlayed'] = $team->getGamesPlayed();
$teamArr['TeamID'] = $team->ID;
if ($allTeams == array()) {
$allTeams['TeamOne'] = $teamArr;
} else {
$allTeams['TeamTwo'] = $teamArr;
}
}
$link = $this->Link();
$data = new ArrayData(array('Teams' => $allTeams, 'ParentLink' => $link, 'Winner' => $game->Winner, 'Score' => $game->ScoreTeamOne . '-' . $game->ScoreTeamTwo));
if ($data->getField('Teams') == array()) {
$data = new ArrayData(array('Content' => 'There are no teams assigned to this game.', 'AddNewTeam' => '<a href="' . $link . 'assignteams/' . $game_id . '" class="btn btn-success">Assign a Team to this game</a>', 'ParentLink' => $this->Link()));
Session::set('GameID', $game_id);
}
return $data->renderWith(array('Game', 'Page'));
}