本文整理汇总了PHP中Agent::mapper方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::mapper方法的具体用法?PHP Agent::mapper怎么用?PHP Agent::mapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::mapper方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_object
public function create_object($data)
{
$data = \Core\Dict::create($data);
$assassin = Agent::mapper()->create_object(array('id' => $data->assassin, 'alias' => $data->assassin_agent_alias));
$target = Agent::mapper()->create_object(array('id' => $data->target, 'alias' => $data->target_agent_alias));
$weapon = Weapon::mapper()->create_object(array('id' => $data->weapon_id, 'name' => $data->weapon_name));
return Kill::create(array('id' => $data->id, 'description' => $data->description, 'assassin' => $assassin, 'target' => $target, 'weapon' => $weapon, 'game' => $game, 'when_happened' => new \DateTime($data->when_happened)), True);
}
示例2: create_object
public function create_object($data)
{
if (empty($data['victor'])) {
$data['victor'] = 0;
} else {
$data['victor'] = Agent::mapper()->create_object(array('id' => $data['victor'], 'alias' => $data['victor_agent_alias']));
unset($data['victor_alias']);
}
$game = Game::create($data, True);
$game->attach_mapper('Kill', Kill::mapper()->attach_storage(\Core\Storage::container()->get_storage('Kill')));
$game->attach_mapper('Agent', Agent::mapper()->attach_storage(\Core\Storage::container()->get_storage('Agent')));
foreach (array('start_date', 'end_date') as $f) {
$game[$f] = new \DateTime($game[$f]);
}
$game->invite_only = (int) $data['invite_only'];
$now = new \DateTime();
if ($game->start_date > $now) {
$game['joinable'] = True;
$game['active'] = False;
$game['state'] = 0;
} else {
if ($game->start_date < $now && $now < $game->end_date) {
$game['joinable'] = False;
$game['active'] = True;
$game['state'] = 1;
} else {
$game['joinable'] = False;
$game['active'] = False;
$game['state'] = 2;
}
}
return $game;
}
示例3: create_object
public function create_object($data)
{
$agent = Agent::mapper()->create_object(array('id' => $data['agent'], 'alias' => $data['agent_alias'], 'avatar' => $data['agent_avatar']));
return Player::create(array('id' => $data['id'], 'agent' => $agent, 'target' => $data['target'], 'credits' => $data['credits'], 'pkn' => $data['pkn'], 'status' => $data['status']));
}